[英]Tensorflow error can't figure out what it is
I was doing tensorflow object detection project to detect sign languages using google colab我正在做 tensorflow object 检测项目,使用 google colab 检测手语
I was getting tensorflow has no attribute gflie error and I found that i have to downgrade to tensorflow 1我得到 tensorflow has no attribute gflie 错误,我发现我必须降级到 tensorflow 1
so I ran .pip install tensorflow==1.13.0rc1
in my colab cell所以我在我的 colab 单元中运行.pip install tensorflow==1.13.0rc1
But now when I run the same cell I get this error which I cant figureout how to resolve但是现在当我运行同一个单元格时,我得到了这个错误,我不知道如何解决
code -代码 -
!python {SCRIPTS_PATH + 'generate_tfrecord.py'} -x {IMAGE_PATH + 'train'} -l {ANNOTATION_PATH + 'label_map.pbtxt'} -o {ANNOTATION_PATH + 'train.record'}
!python {SCRIPTS_PATH + 'generate_tfrecord.py'} -x{IMAGE_PATH + 'test'} -l {ANNOTATION_PATH + 'label_map.pbtxt'} -o {ANNOTATION_PATH + 'test.record'}
Error -错误 -
/usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
/usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/dtypes.py:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/dtypes.py:528: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
/usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/dtypes.py:529: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/dtypes.py:530: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
/usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/dtypes.py:535: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
Traceback (most recent call last):
File "Tensorflow/scripts/generate_tfrecord.py", line 62, in <module>
label_map_dict = label_map_util.get_label_map_dict(label_map)
File "/usr/local/lib/python3.7/dist-packages/object_detection/utils/label_map_util.py", line 164, in get_label_map_dict
label_map = load_labelmap(label_map_path)
File "/usr/local/lib/python3.7/dist-packages/object_detection/utils/label_map_util.py", line 133, in load_labelmap
label_map_string = fid.read()
File "/usr/local/lib/python3.7/dist-packages/tensorflow/python/lib/io/file_io.py", line 125, in read
self._preread_check()
File "/usr/local/lib/python3.7/dist-packages/tensorflow/python/lib/io/file_io.py", line 85, in _preread_check
compat.as_bytes(self.__name), 1024 * 512, status)
File "/usr/local/lib/python3.7/dist-packages/tensorflow/python/util/compat.py", line 61, in as_bytes
(bytes_or_text,))
TypeError: Expected binary or unicode string, got item {
name: "Hello"
id: 1
}
item {
name: "Yes"
id: 2
}
item {
name: "Thank You"
id: 3
}
item {
name: "I Love You"
id: 5
}
item {
name: "No"
id: 5
}
/usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
/usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/dtypes.py:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/dtypes.py:528: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
/usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/dtypes.py:529: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/dtypes.py:530: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
/usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/dtypes.py:535: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
Traceback (most recent call last):
File "Tensorflow/scripts/generate_tfrecord.py", line 62, in <module>
label_map_dict = label_map_util.get_label_map_dict(label_map)
File "/usr/local/lib/python3.7/dist-packages/object_detection/utils/label_map_util.py", line 164, in get_label_map_dict
label_map = load_labelmap(label_map_path)
File "/usr/local/lib/python3.7/dist-packages/object_detection/utils/label_map_util.py", line 133, in load_labelmap
label_map_string = fid.read()
File "/usr/local/lib/python3.7/dist-packages/tensorflow/python/lib/io/file_io.py", line 125, in read
self._preread_check()
File "/usr/local/lib/python3.7/dist-packages/tensorflow/python/lib/io/file_io.py", line 85, in _preread_check
compat.as_bytes(self.__name), 1024 * 512, status)
File "/usr/local/lib/python3.7/dist-packages/tensorflow/python/util/compat.py", line 61, in as_bytes
(bytes_or_text,))
TypeError: Expected binary or unicode string, got item {
name: "Hello"
id: 1
}
item {
name: "Yes"
id: 2
}
item {
name: "Thank You"
id: 3
}
item {
name: "I Love You"
id: 5
}
item {
name: "No"
id: 5
}
Other cells of my colab file我的 colab 文件的其他单元格
WORKSPACE_PATH = 'Tensorflow/workspace/'
SCRIPTS_PATH = 'Tensorflow/scripts/'
APIMODEL_PATH = 'Tensorflow/models/'
ANNOTATION_PATH = WORKSPACE_PATH+'annotations/'
IMAGE_PATH = WORKSPACE_PATH+'images/'
MODEL_PATH = WORKSPACE_PATH+'models/'
PRETRAINED_MODEL_PATH = WORKSPACE_PATH+'pre-trained-models/'
CONFIG_PATH = MODEL_PATH+'my_ssd_mobnet/pipeline.config'
CHECKPOINT_PATH = MODEL_PATH+'my_ssd_mobnet/'
labels = [
{'name':'Hello', 'id':1},
{'name':'Yes', 'id':2},
{'name':'Thank You', 'id':3},
{'name':'I Love You', 'id':5},
{'name':'No', 'id':5}
]
with open(ANNOTATION_PATH + 'label_map.pbtxt', 'w') as f:
for label in labels:
f.write('item { \n')
f.write('\tname:\'{}\'\n'.format(label['name']))
f.write('\tid:{}\n'.format(label['id']))
f.write('}\n')
In generate_tfrecords.py
, remove line 61 and change line 62 to label_map_dict = label_map_util.get_label_map_dict(args.labels_path)
and if you have any line that says fine_tune_checkpoint_version
in the pipeline.config
file, delete that and try在generate_tfrecords.py
中,删除第 61 行并将第 62 行更改为label_map_dict = label_map_util.get_label_map_dict(args.labels_path)
并且如果您在pipeline.config
文件中有任何行显示fine_tune_checkpoint_version
,请删除该行并尝试
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.