-
Notifications
You must be signed in to change notification settings - Fork 97
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
I found a bug and improved it with a huge performance boost #20
Comments
Can you kindly paste your comparison results here? I will take a look and modify the code if necessary. Thanks! |
I have checked your code, and I found that indeed you have modified the for loop to matrix slicing version. This feature is great and I will update the code. For the diagnal parallel problem, does it have a significant impact on the performance? Can you show me your training process and results before and after the modification? |
before improvement.txt |
I still have a little idea of improving this model. When the data needs to be clipped after polygon_random_perspective, the coordinates of the target will exceed the image, and this model does not do it, but when the center of the target is in the image. but this is clearly problematic. This problem can be divided into three cases. The target obtained after the target overflow image is cropped may be a triangle, a quadrilateral, and a pentagon. I think it's possible to do some filtering and then clip the coordinates of the quad to the inside of the image. The accuracy should be improved at this time. I can't think of a good solution for the pentagon. |
Yes, I made the modifications to the def order_corners accordingly. By the way, you concerns regarding the polygon_random_perspective and mosaic also occurred to me before, but hard to find solutions. If you have further improvements, please let me know. Thanks! |
The core idea of this model is to regress the deviation of the four vertices of the quadrilateral to the center point. To simplify the problem, sort the vertices of the quad such that y3, y4 >= y1, y2; x1 <= x2; x4 <= x3. But there is a flaw. If the diagonal of the quadrilateral is parallel to the x-axis, then y2=y3, then this method is ambiguous, and the order of the left and right vertices on the diagonal is undefined. This ambiguity results in greatly reduced performance of the model. Moreover, three for loops are written in the method of sorting vertices, resulting in very slow training. Before the improvement, my data required training for 1000epoch to reach the 0.5 threshold of 94map. After the improvement, my data only needs to train 120epoch to reach the 0.5 threshold of 96map. Also, the pre-improved model cannot be scaled and rotated. After the improvement, the degree of polygon_random_perspective is changed to 90, the scale is changed to 0.5, and the model can still reach 96map at about 150epoch. Below is my code。I want to change jobs in Shanghai, China, Interested can contact me。 28 years old with three years of CV experience。number 18112330636
def order_corners(boxes):
"""
Return sorted corners for loss.py::class Polygon_ComputeLoss::build_targets
Sorted corners have the following restrictions:
y3, y4 >= y1, y2; x1 <= x2; x4 <= x3
"""
if boxes.shape[0] == 0:
return torch.empty(0, 8, device=boxes.device)
The text was updated successfully, but these errors were encountered: