JSON2YOLO icon indicating copy to clipboard operation
JSON2YOLO copied to clipboard

Clip bbox in [0,1]

Open triple-mu opened this issue 3 years ago β€’ 3 comments

triple-mu avatar Aug 07 '22 03:08 triple-mu

Sourcery Code Quality Report

❌  Merging this PR will decrease code quality in the affected files by 0.17%.

Quality metrics Before After Change
Complexity 28.54 😞 28.49 😞 -0.05 πŸ‘
Method Length 273.80 β›” 285.80 β›” 12.00 πŸ‘Ž
Working memory 18.81 β›” 18.81 β›” 0.00
Quality 20.81% β›” 20.64% β›” -0.17% πŸ‘Ž
Other metrics Before After Change
Lines 259 262 3
Changed files Quality Before Quality After Quality Change
general_json2yolo.py 20.81% β›” 20.64% β›” -0.17% πŸ‘Ž

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
general_json2yolo.py convert_ath_json 46 β›” 541 β›” 22 β›” 7.34% β›” Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
general_json2yolo.py convert_vott_json 23 😞 428 β›” 20 β›” 18.53% β›” Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
general_json2yolo.py convert_infolks_json 9 πŸ™‚ 381 β›” 14 😞 35.92% 😞 Try splitting into smaller methods. Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • πŸ™‚ good
  • 😞 poor
  • β›” very poor

The πŸ‘ and πŸ‘Ž indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

sourcery-ai[bot] avatar Aug 07 '22 03:08 sourcery-ai[bot]

@triple-Mu thanks for the PR! clipping is a bit complicated in the xywh space, i.e. you can clip an xywh box and it will still be larger than the image it is in, for example xywh=[0,0,1,1] will be 75% outside of the image it's in.

glenn-jocher avatar Aug 08 '22 15:08 glenn-jocher

Because yolov5 will check box in 0,1. If not it will throw out a warning.

triple-mu avatar Aug 08 '22 16:08 triple-mu

Understood. To ensure the bounding boxes are within the [0, 1] range, you can perform clipping on the x, y, width, and height independently. This will guarantee that the boxes are within the valid range, and YOLOv5 won't throw any warnings. Thank you for bringing this to our attention!

glenn-jocher avatar Nov 09 '23 18:11 glenn-jocher