Apr-15-2023, 04:51 AM
I wrote a text classification program. When I run the program have error. How to fix it?
input_shape = (128, 128, 3) data_dir = '/content/drive/MyDrive/working/dataset' real_data = [f for f in os.listdir(data_dir+'/real') if f.endswith('.png')] fake_data = [f for f in os.listdir(data_dir+'/fake') if f.endswith('.png')] X = [] Y = [] for img in real_data: X.append(img_to_array(load_img(data_dir+'/real/'+img)).flatten() / 255.0) Y.append(1) for img in fake_data: X.append(img_to_array(load_img(data_dir+'/fake/'+img)).flatten() / 255.0) Y.append(0) Y_val_org = Y #Normalization X = np.array(X) Y = to_categorical(Y, 2) #Reshape X = X.reshape(-1, 128, 128, 3) #Train-Test split X_train, X_val, Y_train, Y_val = train_test_split(X, Y, test_size = 0.2, random_state=5)
2234 2235 if n_train == 0: -> 2236 raise ValueError( 2237 "With n_samples={}, test_size={} and train_size={}, the " 2238 "resulting train set will be empty. Adjust any of the " ValueError: With n_samples=0, test_size=0.2 and train_size=None, the resulting train set will be empty. Adjust any of the aforementioned parameters.