Mam takie zadanie , że musze wybrać 10 losowych zdjęć a następnie zrobić do tych 10 zdjęć predykcje , mam problem z:
This solver needs samples of at least 2 classes in the data, but the data contains only one class: 0
chodzi o dwie klasy danych a jest tylko jedna
Nie wiem własnie jak to rozwiązać?
picture = []
for i in range(10):
chosen_picture = random.choice(original_0)
picture.append(chosen_picture)
folder_pic= r"C:\Kodilla\sign langugage\Data\0"
data_pic = []
for file in picture:
img = cv2.imread(os.path.join(folder_pic, file))
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
data_pic.append(img)
X = np.array(data_pic)
y = np.array([0]*len(data_pic))
X_test_pic = np.reshape(X_test, (X_test.shape[0], -1))
X_test_pic = np.mean(X_test, axis=3)
X_train_pic = np.mean(X_train, axis=3)
X_train_pic = np.reshape(X_train, (X_train.shape[0], -1))
scaler_2var = StandardScaler()
X_train_standardized = scaler_2var.fit_transform(X_train_pic)
X_test_standardized = scaler_2var.transform(X_test_pic)
model_lr = LogisticRegression()
model_lr.fit(X_train_standardized, y_train)
predictions_lr = model_lr.predict(X_test_standardized)
W tym miejscu mam ten błąd
This solver needs samples of at least 2 classes in the data, but the data contains only one class: 0