Created
May 2, 2021 17:03
-
-
Save dhenandi/cadd43b1fd3e923daa5c21f3691be1fa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pip install tensorflow==2.4.0 | |
pip install opencv-python | |
pip install keras | |
pip install imageAI | |
from imageai.Detection import ObjectDetection | |
detector = ObjectDetection() | |
import urllib.request | |
urllib.request.urlretrieve( | |
'https://gitlab.com/andreass.bayu/imageai-repo/-/raw/master/yolo-tiny.h5', 'yolo-tiny.h5') | |
model_path = "yolo-tiny.h5" | |
input_path = "./image/image2.jpg" | |
output_path = "image-yolo-tiny.jpg" | |
detector.setModelTypeAsTinyYOLOv3() | |
detector.setModelPath(model_path) | |
detector.loadModel() | |
detection = detector.detectObjectsFromImage(input_image=input_path, output_image_path=output_path) | |
for eachItem in detection: | |
print(eachItem["name"] , " : ", eachItem["percentage_probability"]) | |
from IPython.display import Image | |
Image(filename='image-yolo-tiny.jpg') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment