Search code examples
opencvcomputer-visionobject-detectionyolodarknet

How to detect an object (x) only when it is within another detected object (y) in computer vision?


This is the image...license plate within cars

I have used yolo for car detection, also trained another yolo model for license plate detection which detects license plate of all the vehicles. I want to join this two codes which detects licence plates only for cars. The above image detects licence plate for bus, trucks too. Is there any way where i can detect licence plate only if the vehicle detected is car?


Solution

  • You could ... submit the original image to the car detection model. The NMS output would contain the class, confidence, and bounding box coordinates. For the object classes that equal car, use OpenCV to crop the original image based upon the scaled bounding box output and submit the new image(s) to the license plate model. The output from the second model should only contain license plates within the car regions.