In [0]:
!pip install opencv-python
!pip install tensorflow
!pip install numpy
!pip install scipy
!pip install pillow
!pip install matplotlib
!pip install h5py
!pip install keras

In [0]:
from google.colab import drive
drive.mount('/content/drive')

In [0]:
! pip3 install https://github.com/OlafenwaMoses/ImageAI/releases/download/2.0.2/imageai-2.0.2-py3-none-any.whl

In [15]:
from imageai.Detection import ObjectDetection
import os

execution_path = os.getcwd()
print( os.path.join(execution_path , "resnet50_coco_best_v2.0.1.h5"))
detector = ObjectDetection()
detector.setModelTypeAsRetinaNet()
detector.setModelPath('/content/drive/My Drive/resnet50_coco_best_v2.0.1.h5')
detector.loadModel()
detections = detector.detectObjectsFromImage(input_image="/content/060.JPG", output_image_path="/content/imagenew.jpg")
#detections = detector.detectObjectsFromImage(input_image=os.path.join(execution_path , "image.jpg"), output_image_path=os.path.join(execution_path , "imagenew.jpg"))
for eachObject in detections:
    print(eachObject["name"] , " : " , eachObject["percentage_probability"] )


/content/resnet50_coco_best_v2.0.1.h5
person  :  66.35916829109192
person  :  97.42932319641113