0

I have the following lines of code for vehicle recognition:

import glob
import imageio
import keras
import tensorflow
from imageai.Detection import ObjectDetection

detector = ObjectDetection()

model_path = 'C:/Users/yolo/models/yolo.h5'
input_path = 'C:/Users/yolo/input'
output_path = 'C:/Users/yolo/output'

detector.setModelTypeAsYOLOv3()
detector.setModelPath(model_path)
detector.loadModel()
detection = detector.detectObjectsFromImage(input_image = input_path, input_type = "stream", output_image_path = output_path)

In model_path I have yolov3 model, in input_path I have some jpg images with cars, people, bikes, etc... and output_path is an empty folder I want to fill it with the car extracted image that has the best accuracy in every image from input_path. How can I do that? I think that the last line is the problem.

2 Answers 2

0

Try this:

# This line will make other objects unconsierable
custom_objects = detector.CustomObjects(car=True)
# Here you will pass your image and  
detections = detector.detectCustomObjectsFromImage(custom_objects=custom_objects, input_image=imagpe_path, output_image_path=output_image_path, minimum_percentage_probability=min_prob_you_want)
Sign up to request clarification or add additional context in comments.

Comments

0

name output image an output_path=os.path.join(output_path , name+".jpg")

refer

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.