我按照以下格式训练JPEG格式的图像:
/ train_dir / 1类/ IMG1
/ train_dir / 1类/ IMG2
...
/ train_dir /等级2 / IMG1
/ train_dir /等级2 / IMG2
...
等10个班级,每个班级有大约1000张图片。
需要在此数据集上从头开始重新训练(不能微调)resnet,inceptionV3模型。我怎么能这样做? 我尝试使用这里提到的方法https://github.com/tensorflow/models/tree/master/research/slim#Training但这些似乎只适用于预定义的数据集,如imagenet / MNIST / flowers / CIFAR。
我们提供了一种使用任何TF-Slim数据集从头开始训练模型的简便方法。 以下示例演示如何使用默认值训练Inception V3 ImageNet数据集上的参数。
```壳
DATASET_DIR=/tmp/imagenet
TRAIN_DIR=/tmp/train_logs
python train_image_classifier.py \
--train_dir=${TRAIN_DIR} \
--dataset_name=imagenet \
--dataset_split_name=train \
--dataset_dir=${DATASET_DIR} \
--model_name=inception_v3
```
我编辑了上面提供的代码,希望按照以下方式在我自己的图像上进行训练 -
$ DATASET_DIR=/home/harshit/Music/malignant_or_benign/train/
$ TRAIN_DIR=/home/harshit/Music/malignant_or_benign/out/
$ python train_image_classifier.py --train_dir=${TRAIN_DIR} --dataset_name=mal_ben --dataset_split_name=train --dataset_dir=${DATASET_DIR} --model_name=inception_v3
/usr/local/lib/python2.7/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type.
from ._conv import register_converters as _register_converters
WARNING:tensorflow:From train_image_classifier.py:398: create_global_step (from tensorflow.contrib.framework.python.ops.variables) is deprecated and will be removed in a future version.
Instructions for updating:
Please switch to tf.train.create_global_step
Traceback (most recent call last):
File "train_image_classifier.py", line 571, in <module>
tf.app.run()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 126, in run
_sys.exit(main(argv))
File "train_image_classifier.py", line 404, in main
FLAGS.dataset_name, FLAGS.dataset_split_name, FLAGS.dataset_dir)
File "/home/harshit/Downloads/GIT Repos/models/research/slim/datasets/dataset_factory.py", line 52, in get_dataset
raise ValueError('Name of dataset unknown %s' % name)
ValueError: Name of dataset unknown mal_ben`