Open slavistan opened 1 year ago
you need to cast those floats into integer, that helps for me. I had fixes for this issues, but im not able to push it.
You're not supposed to push changes directly but rather to create a pull request by forking (see here).
That aside, do you have more information why this problem surfaces or when it began to surface? Maybe the added context would be helpful for me and others. When I install labelImg via my package manager it works, whereas the installation via conda is broken in the manner described above.
Same issue for me. Downloading the release version for Windows (v1.8.1) worked but the pip install version crashes (v1.8.6).
I think someone needs to release a new version of labelimg with current code. Version 1.8.6 does not contain the fixed code.
Solution. Error in Qt5. float to int conversion Changed: x:\xxxxx\python-310\Lib\site-packages\libs\canvas.py 526 line: default: p.drawRect(left_top.x(), left_top.y(), rect_width), int(rect_height) new: p.drawRect(int(left_top.x()), int(left_top.y()), int(rect_width), int(rect_height)) 530 line: default: p.drawLine( self.prev_point.x(), 0, self.prev_point.x(), self.pixmap.height()) new: p.drawLine( int(self.prev_point.x()), 0, int(self.prev_point.x()), int(self.pixmap.height())) 531 line: default: p.drawLine( 0, self.prev_point.y(), self.pixmap.width(), self.prev_point.y()) new: p.drawLine( 0, int(self.prev_point.y()), int(self.pixmap.width()), int(self.prev_point.y())) Changed: x:\xxxxx\python-310\Lib\site-packages\labelImg\labelImg.py 965 line: default: bar.setValue(bar.value() + bar.singleStep() units) new: bar.setValue(int(bar.value() + bar.singleStep() units))
Solução. Erro no Qt5. conversão float para int Alterado: x:\xxxxx\python-310\Lib\site-packages\libs\canvas.py 526 linha: padrão: p.drawRect(left_top.x(), left_top.y(), rect_width), int(rect_height) novo: p.drawRect(int(left_top.x()), int(left_top.y()), int(rect_width), int(rect_height)) 530 linha: padrão: p.drawLine( self.prev_point .x(), 0, self.prev_point.x(), self.pixmap.height()) novo: p.drawLine( int(self.prev_point.x()), 0, int(self.prev_point.x( )), int(self.pixmap.height())) 531 linha: padrão: p.drawLine( 0, self.prev_point.y(), self.pixmap.width(), self.prev_point.y()) novo : p.drawLine( 0, int(self.prev_point.y()), int(self.pixmap.width()), int(self.prev_point.y())) Alterado: x:\xxxxx\python-310\ Lib\site-packages\labelImg\labelImg.py 965 linha: padrão: bar.setValue(bar.value() + bar.singleStep() unidades) novo: bar.setValue(int(bar.value() + bar. singleStep() unidades))
here it worked, it gave another error, but I used the same logic to fix it - thanks
Thanks @ptiszai after changing those lines now it it working.
thanks @ptiszai,this problem has bothered me for a few days. I successfully solved it using your method.Thank you very much
thanks @ptiszai
Thanks @ptiszai
In x:\xxxxx\python-310\Lib\site-packages\labelImg\labelImg.py
, I got an error at line 971 and I changed :
default :
self.zoom_widget.setValue(value)
new:
self.zoom_widget.setValue(int(value))
Everything worked fine.
Thanks @ptiszai and @p-mathis
I also got crashes today when showing the labels for bounding boxes so had to make the following change in x:\xxxxx\python-310\Lib\site-packages\libs\shape.py
to line 131:
default:
painter.drawText(min_x, min_y, self.label)
new:
painter.drawText(int(min_x), int(min_y), self.label)
Not sure how many people use the feature to display labels on bounding boxes but this fixed things and along with the previous manual updates I'm no longer getting crashes.
Well, why does it work like this? Why can't we draw float values?
Attempting to zoom via mouse wheel or to draw a bounding box results in an immediate crash. Here's the output when I try to draw a bounding box:
841 sounds like the same issue.