python - Dataset_factory导入错误: Tensorflow fine-tuning a pre-trained model from an existing checkpoint on custom data

标签 python machine-learning tensorflow computer-vision

我正在根据tensorflow github page的说明,在小型自定义数据集上重新训练预训练(inception v1)模型。

创建数据集:

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

微调(https://github.com/tensorflow/models/tree/master/slim#Pretrained - 从现有检查点部分微调模型):

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}"

我收到以下错误消息:

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

我尝试将 dataset_factory 添加到 python 路径,但它不起作用,并且我找不到任何解决方案来解决此问题。这种情况该怎么办?

最佳答案

首先,请确保您拥有最新版本的代码 https://github.com/tensorflow/models/tree/master/slim 。检查数据集文件夹是否存在。您还可以尝试将数据集(不是 dataset_factory.py)文件夹添加到 PYTHONPATH 环境变量中。

关于python - Dataset_factory导入错误: Tensorflow fine-tuning a pre-trained model from an existing checkpoint on custom data,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44996913/

相关文章:

python - 按列 NAME dtype 选择列

python - Pandas 数据框仅选择全部为 True 的列

python-3.x - 为 Flair 模型训练准备数据框

machine-learning - 为什么姿态估计器这么慢?

python - 使用 OutOfBoundsDatetime 儒略历到公历日期

python - SimpleBlobDetector opencv python错误但缺少输出

python - 应如何对音频进行预处理以进行分类?

machine-learning - Convnet Tensorflow 中层的尺寸 : ValueError: Shape of a new variable (logistic_regression/weights) must be fully defined

python - 无法在keras中执行plot_model

tensorflow - 使用GOOGLE COLAB TPU在IMAGENET上训练VGG-16模型需要多长时间?