Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

In [ ]: pip install tensorflow==2.4.

In [ ]: pip install opencv-python

In [ ]: pip install keras

In [ ]: pip install imageAI

In [1]: from imageai.Detection import ObjectDetection

In [2]: detector = ObjectDetection()

In [3]: ort urllib.request

lib.request.urlretrieve('https://gitlab.com/andreass.bayu/imageai-repo/-/raw/maste

Out[3]: ('model.h5', <http.client.HTTPMessage at 0x7f83142f4a58>)

In [4]: model_path = "model.h5"


input_path = "image-2.jpeg"
output_path = "newimage2.jpg"

In [5]: detector.setModelTypeAsYOLOv3()

In [6]: detector.setModelPath(model_path)

In [ ]: detector.loadModel()

In [ ]: detection = detector.detectObjectsFromImage(input_image=input_path, output_image_

In [ ]: for eachItem in detection:


print(eachItem["name"] , " : ", eachItem["percentage_probability"])

In [ ]: from IPython.display import Image


Image(filename='newimage2.jpg')

In [ ]:

You might also like