October 2018
Intermediate to advanced
472 pages
10h 57m
English
Now that we have all the dependencies and pre-trained models ready, we will implement a state-of-the-art object detection model. We will import the ImageAI's ObjectDetection class using the following code:
from imageai.Detection import ObjectDetectionimport osmodel_path = os.getcwd()
Then we create the instance for the ObjectDetection object and set the model type as RetinaNet(). Next, we set the part of the ResNet model that we downloaded and call the loadModel() function:
object_detector = ObjectDetection()object_detector.setModelTypeAsRetinaNet()object_detector.setModelPath( os.path.join(model_path , "resnet50_coco_best_v2.0.1.h5"))object_detector.loadModel()
Once the model is loaded into the memory, we can feed a new image ...
Read now
Unlock full access