COCO格式输出报错:KeyError: 'x'
完整报错: Traceback (most recent call last): File "D:\Anaconda\envs\rtmdet-sam\lib\site-packages\rest_framework\views.py", line 506, in dispatch response = handler(request, *args, **kwargs) File "D:\Anaconda\envs\rtmdet-sam\lib\site-packages\django\utils\decorators.py", line 43, in _wrapper return bound_method(*args, **kwargs) File "D:\Anaconda\envs\rtmdet-sam\lib\site-packages\label_studio\data_export\api.py", line 183, in get export_stream, content_type, filename = DataExport.generate_export_file( File "D:\Anaconda\envs\rtmdet-sam\lib\site-packages\label_studio\data_export\models.py", line 161, in generate_export_file converter.convert(input_json, tmp_dir, output_format, is_dir=False) File "D:\Anaconda\envs\rtmdet-sam\lib\site-packages\label_studio_converter\converter.py", line 209, in convert self.convert_to_coco( File "D:\Anaconda\envs\rtmdet-sam\lib\site-packages\label_studio_converter\converter.py", line 679, in convert_to_coco x, y, w, h = self.rotated_rectangle(label) File "D:\Anaconda\envs\rtmdet-sam\lib\site-packages\label_studio_converter\converter.py", line 916, in rotated_rectangle label["x"], KeyError: 'x' 请问如何解决
你解决了吗?
我也遇到了这个问题,发现是一张图片同时存在RectangleLabels和BrushLabels。然后我把所有的BrushLabels删除就好了
如果是和我一样只需要标注矩形框,在启动后端推理服务的时候把out_mask改为False,这样默认就不会出现BrushLabels了,不然一个个删真的太麻烦了
label-studio-ml start sam --port 8003 --with \
model_name=mobile_sam \
sam_config=vit_t \
sam_checkpoint_file=./mobile_sam.pt \
out_mask=False \
out_bbox=True \
device=cuda:0
我也遇到了这个问题,我需要导出out_poly和out_mask,请问是哪里出问题了