Lakshay Kumar
Lakshay Kumar

Reputation: 33

How to do image classification?

train_data_dir='data/train'
validation_data_dir='data/validation'
nb_test_set_samples=1000
nb_training_set_samples=100
epochs=50
batch_size=20                                                    
train_datagen=ImageDataGenerator(
rescale=1/255, shear_range=0.2 ,zoom_range=0.2, horizontal_flip=True
)                                                          
*train_generator=train_datagen.flow_from_directory(
train_data_dir,
target_size=(img_width,img_height),
batch_size=batch_size,
class_mode='binary'
) *           
*validation_generator=train_datagen.flow_from_directory(
validation_data_dir,
target_size=(img_width,img_height),
batch_size=batch_size,
class_mode='binary'
) *

this is starting code of image classification but i got that error in star lines..i.e [WinError 3] The system cannot find the path specified: 'data/validation'

Upvotes: 2

Views: 111

Answers (1)

David
David

Reputation: 576

In the same place where you execute the code, you should have a data/validation folder inside it you should have folders for each of classes and inside them you should have images.

Also write the path as "./data/validation"

Upvotes: 1

Related Questions