Peter
Peter

Reputation: 11

Dataset_factory importerror: Tensorflow fine-tuning a pre-trained model from an existing checkpoint on custom data

I am working on retraining a a pre-trained (inception v1) model on a small custom dataset based on the instructions of the tensorflow github page

Creating the dataset:

python build_image_data.py 
--train_directory="${TRAIN_DIR}" 
--validation_directory="${VALIDATION_DIR}" 
--output_directory="${OUTPUT_DIRECTORY}" 
--labels_file="${LABELS_FILE}" 
--train_shards=128 
--validation_shards=24 
--num_threads=8

Fine-tuning (https://github.com/tensorflow/models/tree/master/slim#Pretrained - Fine-tuning a model from an existing checkpoint section):

python train_image_classifier.py 
--train_dir="${TRAIN_DIR}"  
--dataset_dir="${DATASET_DIR}" 
--dataset_name=objects 
--dataset_split_name=train 
--model_name=inception_v1 
--checkpoint_path="${CHECKPOINT_PATH}"

And I got the following error message:

File "train_image_classifier.py", line 23, in from datasets import dataset_factory - ImportError: no module named 'datasets'

I tried to add dataset_factory to python path but it did not work and I cannot find any solution to solve this issue. What to do in this case?

Upvotes: 1

Views: 410

Answers (1)

SkyHawk
SkyHawk

Reputation: 11

First of all, make shure that you have the latest version of the code https://github.com/tensorflow/models/tree/master/slim . Check, that datasets folder exists. You also may try to add datasets (not dataset_factory.py) folder to PYTHONPATH environment variable.

Upvotes: 1

Related Questions