labelme icon indicating copy to clipboard operation
labelme copied to clipboard

The software can be opened normally, but it will crash when the next image is displayed

Open Code-Now-QD opened this issue 7 months ago • 2 comments

Provide environment information

python==3.11 labelme==5.4.0 or labelme==5.3.1
Both versions have problems, but this version of labelme 5.2.1 can be used normally

What OS are you using?

ubuntu18.04.06

Describe the Bug

~/ultralytics/data/_1204-1220_new_2d$ labelme images/ --out labels/ --autosave
2024-01-03 16:16:11,073 [INFO   ] __init__:get_config:67- Loading config file from: /home/dkt/.labelmerc
Traceback (most recent call last):
  File "/home/dkt/anaconda3/envs/labelme/lib/python3.11/site-packages/labelme/app.py", line 1157, in fileSelectionChanged
    self.loadFile(filename)
  File "/home/dkt/anaconda3/envs/labelme/lib/python3.11/site-packages/labelme/app.py", line 1591, in loadFile
    self.loadLabels(self.labelFile.shapes)
  File "/home/dkt/anaconda3/envs/labelme/lib/python3.11/site-packages/labelme/app.py", line 1277, in loadLabels
    shape.flags.update(flags)
TypeError: 'NoneType' object is not iterable
Gave up (core dumped)

Expected Behavior

No response

To Reproduce

Use this command to open the software normally labelme images/ --out labels/ --autosave Switch to the next picture, and the app will crash

Code-Now-QD avatar Jan 03 '24 08:01 Code-Now-QD

It is related to these attributes in the json file ("group_id": null, "description": null, "shape_type": "rectangle", "flags": {}, "mask": null), but version 5.2 is used normally. Here is the json source file

{
  "version": "5.4.0",
  "flags": {},
  "shapes": [
    {
      "text": "",
      "label": "trafficlight",
      "points": [
        [
          127.33812949640284,
          381.636690647482
        ],
        [
          180.03597122302156,
          404.658273381295
        ]
      ],
      "group_id": null,
      "description": null,
      "shape_type": "rectangle",
      "flags": {},
      "mask": null
    },
    {
      "text": "",
      "label": "car",
      "points": [
        [
          652.0,
          506.0
        ],
        [
          1033.0,
          742.0
        ]
      ],
      "group_id": null,
      "description": null,
      "shape_type": "rectangle",
      "flags": {},
      "mask": null
    },
    {
      "text": "",
      "label": "car",
      "points": [
        [
          0.0,
          563.0
        ],
        [
          240.77697841726626,
          699.5563549160671
        ]
      ],
      "group_id": null,
      "description": null,
      "shape_type": "rectangle",
      "flags": {},
      "mask": null
    },
    {
      "text": "",
      "label": "car",
      "points": [
        [
          223.0,
          535.0
        ],
        [
          616.0,
          720.0
        ]
      ],
      "group_id": null,
      "description": null,
      "shape_type": "rectangle",
      "flags": {},
      "mask": null
    },
    {
      "text": "",
      "label": "car",
      "points": [
        [
          65.71244635193133,
          558.8583690987124
        ],
        [
          378.8841201716739,
          710.7296137339056
        ]
      ],
      "group_id": null,
      "description": null,
      "shape_type": "rectangle",
      "flags": {},
      "mask": null
    },
    {
      "text": "",
      "label": "car",
      "points": [
        [
          410.0,
          547.476439790576
        ],
        [
          720.0,
          726.476439790576
        ]
      ],
      "group_id": null,
      "description": null,
      "shape_type": "rectangle",
      "flags": {},
      "mask": null
    },
    {
      "text": "",
      "label": "car",
      "points": [
        [
          1655.0,
          542.0
        ],
        [
          1919.0,
          808.0
        ]
      ],
      "group_id": null,
      "description": null,
      "shape_type": "rectangle",
      "flags": {},
      "mask": null
    },
    {
      "text": "",
      "label": "car",
      "points": [
        [
          934.0,
          543.0
        ],
        [
          1278.0,
          752.0
        ]
      ],
      "group_id": null,
      "description": null,
      "shape_type": "rectangle",
      "flags": {},
      "mask": null
    },
    {
      "text": "",
      "label": "car",
      "points": [
        [
          1179.0,
          506.0
        ],
        [
          1631.0,
          786.0
        ]
      ],
      "group_id": null,
      "description": null,
      "shape_type": "rectangle",
      "flags": {},
      "mask": null
    },
    {
      "text": "",
      "label": "truck",
      "points": [
        [
          -0.4303797468353281,
          -0.5316455696201956
        ],
        [
          119.8227848101267,
          123.51898734177217
        ]
      ],
      "group_id": null,
      "description": null,
      "shape_type": "rectangle",
      "flags": {},
      "mask": null
    },
    {
      "text": "",
      "label": "bicyclerider",
      "points": [
        [
          99.8952422522917,
          0.0
        ],
        [
          234.07245744216516,
          131.64556962025313
        ]
      ],
      "group_id": null,
      "description": null,
      "shape_type": "rectangle",
      "flags": {},
      "mask": null
    },
    {
      "text": "",
      "label": "person",
      "points": [
        [
          246.94893059799227,
          0.0
        ],
        [
          382.3919685726758,
          143.03797468354426
        ]
      ],
      "group_id": null,
      "description": null,
      "shape_type": "rectangle",
      "flags": {},
      "mask": null
    },
    {
      "text": "",
      "label": "trafficlight",
      "points": [
        [
          61.85897435897436,
          381.3461538461538
        ],
        [
          116.34615384615384,
          406.66666666666663
        ]
      ],
      "group_id": null,
      "description": null,
      "shape_type": "rectangle",
      "flags": {},
      "mask": null
    },
    {
      "text": "",
      "label": "trafficlight",
      "points": [
        [
          455.910290237467,
          469.39313984168865
        ],
        [
          477.28232189973613,
          503.1662269129288
        ]
      ],
      "group_id": null,
      "description": null,
      "shape_type": "rectangle",
      "flags": {},
      "mask": null
    },
    {
      "text": "",
      "label": "motorcycle",
      "points": [
        [
          389.7435897435897,
          -0.12820512820517038
        ],
        [
          529.0598290598289,
          155.4273504273503
        ]
      ],
      "group_id": null,
      "description": null,
      "shape_type": "rectangle",
      "flags": {},
      "mask": null
    },
    {
      "text": "",
      "label": "signs",
      "points": [
        [
          529.059829059829,
          15.211929251213377
        ],
        [
          690.5982905982905,
          182.9298779691621
        ]
      ],
      "group_id": null,
      "description": null,
      "shape_type": "rectangle",
      "flags": {},
      "mask": null
    },
    {
      "text": "",
      "label": "tricycle",
      "points": [
        [
          689.7435897435897,
          -0.8888888888889426
        ],
        [
          860.6837606837607,
          176.75213675213672
        ]
      ],
      "group_id": null,
      "description": null,
      "shape_type": "rectangle",
      "flags": {},
      "mask": null
    },
    {
      "text": "",
      "label": "roadblocks",
      "points": [
        [
          865.7470518230012,
          -0.07941144650007459
        ],
        [
          1046.9436330195826,
          207.28810992102132
        ]
      ],
      "group_id": null,
      "description": null,
      "shape_type": "rectangle",
      "flags": {},
      "mask": null
    },
    {
      "text": "",
      "label": "trafficlight",
      "points": [
        [
          179.39313984168868,
          369.6569920844327
        ],
        [
          226.8865435356201,
          404.7493403693931
        ]
      ],
      "group_id": null,
      "description": null,
      "shape_type": "rectangle",
      "flags": {},
      "mask": null
    },
    {
      "label": "truck",
      "points": [
        [
          641.8965517241379,
          301.2068965517242
        ],
        [
          685.0,
          344.31034482758616
        ]
      ],
      "group_id": null,
      "description": "",
      "shape_type": "rectangle",
      "flags": {},
      "mask": null
    }
  ],
  "imagePath": "../images/1204_images_1.jpg",
  "imageData": null,
  "imageHeight": 1080,
  "imageWidth": 1920,
  "text": ""
}

Code-Now-QD avatar Jan 03 '24 08:01 Code-Now-QD

@Code-Now-QD Can you provide me the whole data to reproduce?

zip -r images labels data.zip

wkentaro avatar Jan 06 '24 13:01 wkentaro