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

large rotation steps do not add up to 360 deg. #16

Open
jwstolk opened this issue Jun 21, 2020 · 2 comments
Open

large rotation steps do not add up to 360 deg. #16

jwstolk opened this issue Jun 21, 2020 · 2 comments

Comments

@jwstolk
Copy link

jwstolk commented Jun 21, 2020

It currently is not possible to return to horizontal or vertical using the large Z and V, or even the small X and C steps. This is caused by the large steps being 0.1 radians and the small steps 0.1 radians, which will never add up to 2*Pi.

proposed to use math.radians() in roLabelImg-master/libs/canvas.py as below:

            self.selectedShape.isRotated and not self.rotateOutOfBound(math.radians(45)):
            self.selectedShape.rotate(math.radians(45))
            self.shapeMoved.emit() 
            self.update()  
        elif key == Qt.Key_X and self.selectedShape and\
             self.selectedShape.isRotated and not self.rotateOutOfBound(math.radians(2.5)):
            self.selectedShape.rotate(math.radians(2.5)) 
            self.shapeMoved.emit()
            self.update()  
        elif key == Qt.Key_C and self.selectedShape and\
             self.selectedShape.isRotated and not self.rotateOutOfBound(-math.radians(2.5)):
            self.selectedShape.rotate(-math.radians(2.5)) 
            self.shapeMoved.emit()
            self.update()  
        elif key == Qt.Key_V and self.selectedShape and\
             self.selectedShape.isRotated and not self.rotateOutOfBound(-math.radians(45)):
            self.selectedShape.rotate(-math.radians(45))
            self.shapeMoved.emit()
            self.update()

This does 45deg large steps and 2.5 deg small steps, but anything reasonable will do.
It's also much easier to understand for someone to change the values.

@jwstolk
Copy link
Author

jwstolk commented Jun 21, 2020

(for info) My original plan was to label each object twice, once with a rectangle and once with a 45 degree rotated rectangle, make a 45-degree rotated version of the training images and train YOLO with both version of each image, with the appropriate bounding rectangle.

Then run each frame twice through YOLO, once normally and once rotated 45 deg. Then merge the resulting bounding boxes into an octagonal outline. This would need minimal changes to YOLO but would half the framerate and require each frame to be rotated 45 deg.

(Now thinking about a better solution that will require some larger changes to roLabelimg and YOLO.)

@jaychen1996-byte
Copy link

@jwstolk Hi,bro,How is your 45-degree rotating YOLO model trained?

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

No branches or pull requests

2 participants