Moondra
Moondra

Reputation: 4511

Tensorflow image retraining with Inception3; where should new images be stored?

So, I'm trying to retrain the image classifier model Inception 3 via their retrain.py code from their github ("https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/image_retraining/retrain.py") (The code is really lengthy, so I figured I shouldn't post it here)

However, I can't seem to figure out the proper way to store the images I want to use or in which directory I should store them. I'm using Windows 7 with Python 3.5

Currently, I have the images in a folder called Images that are further broken down in sub-folders which are named according to the labels I want.

So as an example, It's something like Images -> 'Cats' -> 'Dogs' -> 'Fish'

where is Images is the main folder, and the subfolders are the types of animals.

The Images folder is at the location C:\tmp\ which is the location where the Mnist tutorial autmatically downloaded the the Mnist digit dataset to, when I ran the mnist tutorial.py. So I figured I should store my images around the same location.

When I run the retrain.py from the above github link:

I get the following error

Image directory "" not found. File "C:\Users\Amit\AppData\Local\Programs\Python\Python35\Lib\site-packages\tensorflow\models\image\imagenet\tf_retrain.py", line 668, in main class_count = len(image_lists.keys()) AttributeError: 'NoneType' object has no attribute 'keys'

I've looked over the code and tried to find the default value for Image_dir which is an argument for the function def create_image_lists (which seems to be where the script is looking for images, but can't find it, or maybe I'm not understanding the code properly.

EDIT: I'm having trouble running python 3.5 via command prompt, so I can't use argparse.

Thank you.

Upvotes: 0

Views: 1575

Answers (1)

Yao Zhang
Yao Zhang

Reputation: 5781

Are you able to change the default folder path to your path (C:\tmp\Images) here? https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/image_retraining/retrain.py#L903

Upvotes: 1

Related Questions