<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def get_data(path, activation):
    '''Get the dataset
    '''
    data = []
    image_names = []
    for filename in os.listdir(path):
        img = cv2.imread(os.path.join(path,filename), cv2.IMREAD_GRAYSCALE)
        image_names.append(filename)
        if img is not None:
            data.append(img)

    data = np.asarray(data)

    if activation == 'sigmoid':
        data = data.astype(np.float32)/(255.0)
    elif activation == 'tanh':
        data = data.astype(np.float32)/(255.0/2) - 1.0

    data = data.reshape((data.shape[0], 1, data.shape[1], data.shape[2]))

    np.random.seed(1234)
    p = np.random.permutation(data.shape[0])
    X = data[p]

    return X, image_names