! pip install tensorflow



! pip install --upgrade pip

"""
Explanation: Citation-https://towardsdatascience.com/object-detection-with-10-lines-of-code-d6cb4d86f606
End of explanation
"""


! pip install numpy -I

import numpy.core.multiarray

!pip install spacy

! pip install scipy


! pip install opencv-python



! pip install pillow



! pip install matplotlib



! pip install h5py



! pip install keras



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

"""
Explanation: conda install numpy
End of explanation
"""


import os as os

os.getcwd()

os.chdir('C:\\Users\\KOGENTIX\\Desktop\\image')

os.getcwd()

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"))
detector.loadModel()
detections = detector.detectObjectsFromImage(input_image=os.path.join(execution_path , "image.jpeg"), output_image_path=os.path.join(execution_path , "imagenew.jpeg"))

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

"""
Explanation: Download the RetinaNet model file that will be used for object detection via this link
https://github.com/OlafenwaMoses/ImageAI/releases/download/1.0/resnet50_coco_best_v2.0.1.h5
End of explanation
"""


