labelme闪退的可能原因之一

用labelme.exe打开一个有好几张图的文件夹的时候,可能会闪退。但是也看不到是什么错误,没有弹窗错误提示。

这个时候,可以从命令行打开exe文件,或者用python的pip安装labelme。从命令行启动labelme之后,再次打开图像文件夹。还是会闪退,但是能看到报错了。

Traceback (most recent call last):File "d:\Users\qqyor\anaconda3\envs\py37\lib\site-packages\PIL\JpegImagePlugin.py", line 630, in _saverawmode = RAWMODE[im.mode]
KeyError: 'RGBA'The above exception was the direct cause of the following exception:Traceback (most recent call last):File "d:\Users\qqyor\anaconda3\envs\py37\lib\site-packages\labelme\app.py", line 1110, in fileSelectionChangedself.loadFile(filename)File "d:\Users\qqyor\anaconda3\envs\py37\lib\site-packages\labelme\app.py", line 1510, in loadFileself.imageData = LabelFile.load_image_file(filename)File "d:\Users\qqyor\anaconda3\envs\py37\lib\site-packages\labelme\label_file.py", line 66, in load_image_fileimage_pil.save(f, format=format)File "d:\Users\qqyor\anaconda3\envs\py37\lib\site-packages\PIL\Image.py", line 2212, in savesave_handler(self, fp, filename)File "d:\Users\qqyor\anaconda3\envs\py37\lib\site-packages\PIL\JpegImagePlugin.py", line 632, in _saveraise OSError(f"cannot write mode {im.mode} as JPEG") from e
OSError: cannot write mode RGBA as JPEG

原因是图像是rgba四个通道的,第四个通道是透明通道。

把图片转换一下成三通道的图像试试,一般可以解决。


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部