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

fix: use same color for labels and boxes #635

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

3omer
Copy link

@3omer 3omer commented Feb 5, 2021

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

@3omer
Copy link
Author

3omer commented Feb 5, 2021

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
Copy link

codecov bot commented Feb 5, 2021

Codecov Report

Merging #635 (b5d82e7) into master (c4baba9) will decrease coverage by 1.24%.
The diff coverage is 100.00%.

@@            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     

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.

None yet

1 participant