训练 InceptionV3 网络不工作(Tensorflow)

Training an InceptionV3 network not working (Tensorflow)

我已经安装了最新版本的 Tensorflow、bazel。

要从头开始训练模型,我必须 运行 在此 link https://github.com/tensorflow/models 上执行以下命令:

bazel-bin/inception/imagenet_train --num_gpus=1 --batch_size=32 --train_dir=/tmp/imagenet_train --data_dir=/tmp/imagenet_data

报错

bazel-bin/inception/image_train: No such file or directory

bazel-bin 似乎是文件而不是目录。

此外,如果尝试去 /models/inception/inception 路径 并尝试 运行 imagenet_train.py 文件它抛出一个错误:

command not found error

我不知道为什么它不起作用。我已经遵循了每一步。这让我困扰了很长时间。

原回答:

You have to build imagenet_train first, what is the output when you run bazel build //inception:imagenet_train?

bazel-bin is a symbolic link to a directory.

根据您在下面的评论 (~/models#),您 运行 Bazel 似乎在错误的目录中。在运行 bazel:

之前你必须cdinception/目录
cd inception
/opt/DL/bazel/bin/bazel build //inception:imagenet_train

Tensorflow选择了一个很奇怪的项目结构:models/是一个项目,但是models的每个子目录也是自己的项目。我不确定他们为什么这样做,但你必须在他们自己的目录中构建子项目(如 inception),而不是顶级目录。

//inception:imagenet_train 被称为 目标 : 之前的所有内容都会告诉您目标的定义位置(inception/ 目录中的 BUILD 文件)。 Tensorflow 将所有内容都放在与其项目同名的子目录中(例如,此目标在 ~/models/inception/inception/BUILD 中定义),从而使这更加混乱。

imagenet_train是target的标识符,可以看它的定义here

有关目标是什么的更详细说明,请参阅 Bazel 的 Getting Started 文档。