Skip to content

Commit

Permalink
Create object_detection.py
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored May 11, 2024
1 parent 4c37101 commit 1771c53
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions computer_vision/object_detection.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import cv2

def detect_objects(image, config):
# Load the object detection model
net = cv2.dnn.readNetFromDarknet(config['model_config'], config['model_weights'])

# Perform object detection on the image
blob = cv2.dnn.blobFromImage(image, config['input_scale'], config['input_size'], config['mean_subtraction'])
net.setInput(blob)
detections = net.forward()

return detections

0 comments on commit 1771c53

Please sign in to comment.