Skip to content

fix: use same color for labels and boxes#635

Open
3omer wants to merge 1 commit into
OlafenwaMoses:masterfrom
3omer:master
Open

fix: use same color for labels and boxes#635
3omer wants to merge 1 commit into
OlafenwaMoses:masterfrom
3omer:master

Conversation

@3omer

@3omer 3omer commented Feb 5, 2021

Copy link
Copy Markdown

Label's color is always set to (255, 0, 0)
I changed it to use same color used for drawing boxes

@3omer

3omer commented Feb 5, 2021

Copy link
Copy Markdown
Author

test example

from imageai.Detection import ObjectDetection
import os

execution_path = os.getcwd()

detector = ObjectDetection()
detector.setModelTypeAsRetinaNet()
detector.setModelPath( os.path.join(execution_path , "resnet50_coco_best_v2.0.1.h5")) # Download the model via this link https://github.com/OlafenwaMoses/ImageAI/releases/tag/1.0
detector.loadModel()
detector._ObjectDetection__box_color = (0, 0, 255) #This is red in BGR 
detections = detector.detectObjectsFromImage(input_image=os.path.join(execution_path , "2.jpg"), 
output_image_path=os.path.join(execution_path , "2_detected.jpg"), 
minimum_percentage_probability=40)

for eachObject in detections:
    print(eachObject["name"] , " : ", eachObject["percentage_probability"], " : ", eachObject["box_points"] )
    print("--------------------------------")

Result before the change:
2_detected_bug

Result after the change:

2_detected

@codecov

codecov Bot commented Feb 5, 2021

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.28%. Comparing base (c4baba9) to head (b5d82e7).
⚠️ Report is 95 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #635      +/-   ##
==========================================
- Coverage   66.53%   65.28%   -1.25%     
==========================================
  Files          40       40              
  Lines        3762     3762              
==========================================
- Hits         2503     2456      -47     
- Misses       1259     1306      +47     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Successfully merging this pull request may close these issues.

1 participant