Clip bbox in [0,1]
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!
@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.
Because yolov5 will check box in 0,1. If not it will throw out a warning.
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!