首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >generate_tfrecord.py:错误:无法识别的参数-在尝试为测试和训练数据创建TF记录文件时出错

generate_tfrecord.py:错误:无法识别的参数-在尝试为测试和训练数据创建TF记录文件时出错
EN

Stack Overflow用户
提问于 2021-05-25 13:20:47
回答 2查看 659关注 0票数 2

在使用generate_tfrecord.py时,我总是会得到"generate_tfrecord.py: error: un为人所识别的参数“的错误。

但是,我没有改变任何东西,我使用了来自自定义对象检测教程的相同命令,来自TFOD网站。链接:https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/training.html

在Google和本地python环境上都进行了尝试,但仍然存在相同的问题。

以前有人经历过这个错误,如果是的话,你是如何解决的?请帮帮忙。谢谢!

代码语言:javascript
运行
复制
python generate_tfrecord.py -x [PATH_TO_IMAGES_FOLDER]/train -l [PATH_TO_ANNOTATIONS_FOLDER]/label_map.pbtxt -o [PATH_TO_ANNOTATIONS_FOLDER]/train.record

我所做的改变:

代码语言:javascript
运行
复制
python generate_tfrecord.py -x C:/Users/prana/Desktop/cnn_system/images/train -l C:/Users/prana/Desktop/cnn_system/annotations/label_map.pbtxt -o C:/Users/prana/Desktop/cnn_system/annotations/train.record

在科拉布,我试过这个:

代码语言:javascript
运行
复制
!python generate_tfrecord.py -i /content/trainingdemo/images/train -l /content/trainingdemo/annotations/label_map.pbtxt -o /content/trainingdemo/annotations/train.record

所有文件都经过了双重检查,它们都在正确的路径上存在。

EN

回答 2

Stack Overflow用户

发布于 2022-04-16 00:34:11

这对我有用,可能对别人有用。

尽量不要在代码行中留下任何空格,将空格替换为_

在此之前:

代码语言:javascript
运行
复制
python generate_tfrecord.py -x D:/Semestre/graduation project/files/TensorFlow/workspace/training/images/train -l D:/Semestre/graduation project/files/TensorFlow/workspace/training/annotations/labelmap.pbtxt -o D:/Semestre/graduation project/files/TensorFlow/workspace/training/annotations/train.record

之后:

代码语言:javascript
运行
复制
python generate_tfrecord.py -x D:/Semestre/graduation_project/files/TensorFlow/workspace/training/images/train -l D:/Semestre/graduation_project/files/TensorFlow/workspace/training/annotations/labelmap.pbtxt -o D:/Semestre/graduation_project/files/TensorFlow/workspace/training/annotations/train.record

我在毕业设计之间有一个空间

票数 0
EN

Stack Overflow用户

发布于 2022-07-11 13:03:51

我也有同样的问题。经过一整天的搜索,我想出了解决办法!我们需要将这些文件名放在倒逗号("myFile")中,它们的名字中有空格(MyFile)。

示例:转换如下:

代码语言:javascript
运行
复制
python generate_tfrecord.py -x D:/Semestre/graduation project/files/TensorFlow/workspace/training/images/train -l D:/Semestre/graduation project/files/TensorFlow/workspace/training/annotations/labelmap.pbtxt -o D:/Semestre/graduation project/files/TensorFlow/workspace/training/annotations/train.record

对此:

代码语言:javascript
运行
复制
python generate_tfrecord.py -x D:/Semestre/"graduation project"/files/TensorFlow/workspace/training/images/train -l D:/Semestre/"graduation project"/files/TensorFlow/workspace/training/annotations/labelmap.pbtxt -o D:/Semestre/"graduation project"/files/TensorFlow/workspace/training/annotations/train.record

简而言之:把这些文件名放在中间有空格的逗号中。我的档案到“我的档案”

希望这会有所帮助:)

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67688869

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档