Keshav Tangri
1 min readFeb 1, 2021

--

Well first, using ImageDataGenerator I am getting all the images which I want to predict in the predict variable via the following command:

predict = predict_datagen.flow_from_directory(path_test, target_size=(227,227), batch_size = 1,class_mode='categorical')

Now this outputs the following :

Found 7301 images belonging to 1 classes

That means 7301 images are loaded on fly in the memory for height and weight 227 x 227.

Now the the values 3300, 7002, 512 in code are basically the index values out of the 7301 images which were loaded in the memory.

If you are willing to pass a custom image, one way is just making a separate directory with your custom images (just like in this present dataset we have the seg_pred folder) and then using this code only to first import them ImageDatagenerator and using the indexes to look at the images.

Another way is to make a code snippet and asking the user for image path, then opening it or by using tkinter package you can make an open file GUI box, allowing the user to select image from his/her machine.

If you have any query or if anything is not clear, you can ask again.

Regards,

Keshav Tangri

--

--

Keshav Tangri
Keshav Tangri

Written by Keshav Tangri

Deep Learning Enthusiast, Full Stack Native Android App Dev + Web Developer, Software Developer - Python

No responses yet