通过Ubuntu终端在Google Cloud实例上安装了DELF,使用以下说明进行图像识别:https://github.com/tensorflow/models/blob/master/research/delf/INSTALL_INSTRUCTIONS.md
测试安装的最后一步是“应该没有任何问题地返回。这表明DELF包已成功加载。”我运行它,但它给了我
"/home/shared/anaconda3/lib/python3.6/site-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 /home/shared/anaconda3/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/datasets/base.py:198: retry (from tensorflow.contrib.learn.python.learn.datasets.base) is deprecated and will be removed in a future version.
Instructions for updating:
Use the retry module or similar alternatives."所以,不确定这是否意味着DELF安装成功。
然后,在尝试示例运行delf (https://github.com/tensorflow/models/blob/master/research/delf/EXTRACTION_MATCHING.md)时,当我运行
python extract_features.py \
--config_path delf_config_example.pbtxt \
--list_images_path list_images.txt \
--output_dir data/oxford5k_features它返回错误
"Traceback (most recent call last):
File "extract_features.py", line 34, in <module>
from delf import delf_config_pb2
ImportError: cannot import name 'delf_config_pb2'" 所以它导入的是delf,而不是'delf_config_pb2‘。
当我在本地的ubuntu上遵循完全相同的指令时,它可以工作,但在google cloud ubuntu实例上失败了。
此外,当我停止实例然后重新启动它时,它显示delf未安装,甚至无法导入delf;因此,每次我都必须再次按照安装说明进行操作。
发布于 2019-01-11 18:01:38
Protoc编译器生成delf_config_pb2文件
因此,请确保您正确安装了它
wget https://github.com/google/protobuf/releases/download/v3.3.0/protoc-3.3.0-linux-x86_64.zip
unzip protoc-3.3.0-linux-x86_64.zip
echo 'export PATH=/path/to/protoc/bin:$PATH' >> ~/.bashrc
source ~/.bashrc或者在这里查看如何安装protoc编译器
[http://google.github.io/proto-lens/installing-protoc.html][1]
检查是否安装了protoc编译器。
在终端上键入protoc,看看该命令是否有效。
安装protoc后,键入以下命令
# From tensorflow/models/research/delf/
protoc delf/protos/*.proto --python_out=.你可以将路径添加到谷歌云中的.bashrc文件中,而不需要重新安装delf。
在谷歌云中。(检查已安装的tensorflow模型文件夹的位置)
echo 'export PYTHONPATH=$PYTHONPATH:tensorflow/models/research' >> ~/.bashrc https://stackoverflow.com/questions/53551368
复制相似问题