项目场景:
在使用labelme进行数据标注时,需要进行labelme_json_to_dataset,以此来进行数据格式的转换,然而在运行 :
python json2dataset.py /home/l/label_line/save_vedio_frame/label_2
报错了!!!
问题描述
AttributeError: module 'labelme.utils' has no attribute 'draw_label'
该错误表明没有该模块,意味版本有错误!!!
json2dataset.py:15: UserWarning: This script is aimed to demonstrate how to convert the
JSON file to a single image dataset, and not to handle
multiple JSON files to generate a real-use dataset.warnings.warn("This script is aimed to demonstrate how to convert the\n"
Traceback (most recent call last):File "json2dataset.py", line 90, in <module>main()File "json2dataset.py", line 66, in mainlbl_viz = utils.draw_label(lbl, img, captions)
AttributeError: module 'labelme.utils' has no attribute 'draw_label'
原因分析:
提示:这里填写问题的分析:
该错误表明没有该模块,意味版本labelme有错误!!!
为此进行版本的更换就好!!!!
解决方案:
卸载原来的版本:
pip uninstall labelme
终端输出以下:
Found existing installation: labelme 5.2.1
Uninstalling labelme-5.2.1:Would remove:/home/l/anaconda3/envs/labelme/bin/labelme/home/l/anaconda3/envs/labelme/bin/labelme_draw_json/home/l/anaconda3/envs/labelme/bin/labelme_draw_label_png/home/l/anaconda3/envs/labelme/bin/labelme_json_to_dataset/home/l/anaconda3/envs/labelme/bin/labelme_on_docker/home/l/anaconda3/envs/labelme/lib/python3.6/site-packages/labelme-5.2.1.dist-info/*/home/l/anaconda3/envs/labelme/lib/python3.6/site-packages/labelme/*
Proceed (Y/n)? ySuccessfully uninstalled labelme-5.2.1
接着安装对应的版本的labelme
终端输入:
pip install labelme==3.16.2
出现了以下的结果:
。。。。Stored in directory: /tmp/pip-ephem-wheel-cache-5mip06jz/wheels/5a/28/89/d8f80daa134da8ba68e55a556bfd142a99fa4534439282c410
Successfully built labelme
Installing collected packages: labelme
Successfully installed labelme-3.16.2
好的,安装完成了!!!
欧克欧克,这样问题就解决了!!可以运行上面的额代码了!