Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: <labelme.shape.Shape object at 0x000001BFA54D6310> is not in list #1396

Open
monkeycc opened this issue Jan 15, 2024 · 5 comments
Labels
bug issue

Comments

@monkeycc
Copy link

win11
python 3.11
labelme 5.4.1


Traceback (most recent call last):
  File "E:\anaconda3\envs\PY311\Lib\site-packages\labelme\widgets\canvas.py", line 973, in keyReleaseEvent
    index = self.shapes.index(self.selectedShapes[0])
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: <labelme.shape.Shape object at 0x000001BFA54D6310> is not in list
@wkentaro wkentaro added the bug issue label Jan 17, 2024
@wkentaro
Copy link
Owner

@monkeycc Thanks for the report. Do you know how to reproduce this?

@starn1
Copy link

starn1 commented Apr 4, 2024

win11 python 3.11 labelme 5.4.1


Traceback (most recent call last):
  File "E:\anaconda3\envs\PY311\Lib\site-packages\labelme\widgets\canvas.py", line 973, in keyReleaseEvent
    index = self.shapes.index(self.selectedShapes[0])
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: <labelme.shape.Shape object at 0x000001BFA54D6310> is not in list

解决了吗 我也有一样的问题

@mafeng199325
Copy link

(base) D:\软件安装\labelme\cvat-2.14.4>labelme
2024-06-28 11:58:14,133 [INFO ] init:get_config:67- Loading config file from: C:\Users\Administrator.labelmerc
Traceback (most recent call last):
File "D:\Anaconda3\lib\site-packages\labelme\widgets\canvas.py", line 973, in keyReleaseEvent
index = self.shapes.index(self.selectedShapes[0])
ValueError: <labelme.shape.Shape object at 0x000001B1803AFD00> is not in list

@papertiger0016
Copy link

papertiger0016 commented Jul 16, 2024

Hi, I'm having the same issue as well. Below are what information I could provide:

Provide environment information
python=3.9.7
labelme = v5.0.5 (I heard the same thing happening in recent versions such as v5.4.1 as well.

What OS are you using?
win11

Describe the Bug
The program crashes in every 10~15 instances, when I'm editing a label or after I finish and move to the next file.
This seems to happen more often when the editing involves a polygon label(compared to a rectangle or a line),
And it also seems to happen more often when moving to the next file than it does while editing.

The error message displayed is as below.

Traceback (most recent call last):
File "C:\Users\selectstar\anaconda3\lib\site-packages\labelme\widgets\canvas.py", line 812, in keyReleaseEvent
index = self.shapes.index(self.selectedShapes[0])
ValueError: <labelme.shape.Shape object at 0x0000026EDB226580> is not in list

Expected Behavior
The program continues to run without crashing

To Reproduce
After loading a list of files using "Open Dir", edit a polygon label and move to the next file.

@yixing98
Copy link

An easy way around it:

    def keyReleaseEvent(self, ev):
        modifiers = ev.modifiers()
        if self.drawing():
            if int(modifiers) == 0:
                self.snapping = True
        elif self.editing():
            if self.movingShape and self.selectedShapes:
                # index = self.shapes.index(self.selectedShapes[0])
                # if self.shapesBackups[-1][index].points != self.shapes[index].points:
                try:
                    index = self.shapes.index(self.selectedShapes[0])
                except ValueError:
                    index = None
                    print('self.selectedShapes[0] is not in self.shapes')

                if index and self.shapesBackups[-1][index].points != self.shapes[index].points:
                    self.storeShapes()
                    self.shapeMoved.emit()

                self.movingShape = False

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug issue
Projects
None yet
Development

No branches or pull requests

6 participants