logo
Loading...

執行create_pet_tf_record.py 找不到object_detection.protos - Cupoy

不好意思, 不太熟悉Python module path 怎樣運作,請指教...object_det...

cvdl-2,cvdl-2-d48

執行create_pet_tf_record.py 找不到object_detection.protos

2020/04/13 下午 07:30
電腦視覺深度學習討論版
WP
觀看數:27
回答數:2
收藏數:2
cvdl-2
cvdl-2-d48

不好意思, 不太熟悉Python module path 怎樣運作,請指教...

object_detection.protos/string_int_label_map_pb2.py 是建在的, 但不知為何找不到。


!pwd

/content/gdrive/My Drive/models/research


for path in sys.path:

     print(path)

/env/python /usr/lib/python36.zip /usr/lib/python3.6 /usr/lib/python3.6/lib-dynload /usr/local/lib/python3.6/dist-packages /usr/lib/python3/dist-packages /usr/local/lib/python3.6/dist-packages/IPython/extensions /root/.ipython


!python object_detection/dataset_tools/create_pet_tf_record.py \

--label_map_path=object_detection/data/pet_label_map.pbtxt \

--data_dir=/content/gdrive/My\ Drive/models/research \

--output_dir=/content/gdrive/My\ Drive/models/research

!ls *.record*


2020-04-13 11:21:40.452298: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.1 Traceback (most recent call last):   File "object_detection/dataset_tools/create_pet_tf_record.py", line 44, in <module>     from object_detection.utils import label_map_util   File "/usr/local/lib/python3.6/dist-packages/object_detection-0.1-py3.6.egg/object_detection/utils/label_map_util.py", line 27, in <module>     from object_detection.protos import string_int_label_map_pb2 ImportError: cannot import name 'string_int_label_map_pb2' ls: cannot access '*.record*': No such file or directory

回答列表

  • 2020/04/14 上午 07:06
    WP
    贊同數:0
    不贊同數:0
    留言數:1

    重新執行前面的setup後,終於成功繼續, 但最後又卡了, 無論用 tf1.x 還是2.2, 都出現兩處問題:


    1. 'tensorflow' has no attribute 'app' 

    2. 'tensorflow' has no attribute 'contrib'


    Traceback (most recent call last):   File "object_detection/dataset_tools/create_pet_tf_record.py", line 46, in <module>     flags = tf.app.flags AttributeError: module 'tensorflow' has no attribute 'app'


    pet_faces_train.record-00000-of-00010  pet_faces_val.record-00000-of-00010 pet_faces_train.record-00001-of-00010  pet_faces_val.record-00001-of-00010 pet_faces_train.record-00002-of-00010  pet_faces_val.record-00002-of-00010 pet_faces_train.record-00003-of-00010  pet_faces_val.record-00003-of-00010 pet_faces_train.record-00004-of-00010  pet_faces_val.record-00004-of-00010 pet_faces_train.record-00005-of-00010  pet_faces_val.record-00005-of-00010 pet_faces_train.record-00006-of-00010  pet_faces_val.record-00006-of-00010 pet_faces_train.record-00007-of-00010  pet_faces_val.record-00007-of-00010 pet_faces_train.record-00008-of-00010  pet_faces_val.record-00008-of-00010 pet_faces_train.record-00009-of-00010  pet_faces_val.record-00009-of-00010



    2020-04-13 22:59:32.738838: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.1 Traceback (most recent call last):   File "object_detection/model_main.py", line 26, in <module>     from object_detection import model_lib   File "/usr/local/lib/python3.6/dist-packages/object_detection-0.1-py3.6.egg/object_detection/model_lib.py", line 27, in <module>     from object_detection import eval_util   File "/usr/local/lib/python3.6/dist-packages/object_detection-0.1-py3.6.egg/object_detection/eval_util.py", line 40, in <module>     slim = tf.contrib.slim AttributeError: module 'tensorflow' has no attribute 'contrib'

  • 2020/04/16 下午 04:02
    Jeffrey
    贊同數:0
    不贊同數:0
    留言數:1

    請確認一下, 環境安裝的套件:

    1. Windows/Linux? 還是 Windows+Anaconda?

    2. 安裝 python3.6? tensorflow 使用 CPU or GPU 的版本?

    libcudart.so  --> 應該是 GPU LIB.


    Linux 參考:


    1. sudo apt install protobuf-compiler #來安裝protobuf,

    2. 將object-detection API中的models/research/object_detection/protos/string_int_label_map.proto

    下載下来,

    3. 用protoc your/path/to/protos/string_int_label_map.proto --python_out=.命令生成string_int_label_map_pb2.py文件。