Pretrained Model Weights
OpenCV Example Scripts
Run these scripts locally with Python + OpenCV. Copy any script to get started.
Known Object Detection
opencv_known_objects.py
Detect 80 COCO classes using RT-DETR with your webcam.
"""
Known Object Detection (RT-DETR)
Run: python opencv_known_objects.py
Requirements: pip install -r requirements.txt
"""
import cv2
from object_intelligence import ObjectDetector
def main():
detector = ObjectDetector()
detector.set_mode("known")
camera = cv2.VideoCapture(0)
print("[INFO] Press 'q' to quit...")
while True:
success, frame = camera.read()
if not success:
break
annotated_frame, detections = detector.detect_and_draw(frame)
cv2.imshow("Known Object Detection (RT-DETR)", annotated_frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
camera.release()
cv2.destroyAllWindows()
if __name__ == "__main__":
main()Open Vocabulary Discovery
opencv_open_vocabulary.py
Detect any object using natural language with YOLO-World.
"""
Open Vocabulary Discovery (YOLO-World)
Run: python opencv_open_vocabulary.py
"""
import cv2
from object_intelligence import ObjectDetector
def main():
detector = ObjectDetector()
detector.set_mode("open_vocabulary")
detector.set_vocabulary(["red cup", "black laptop", "screwdriver", "wireless mouse"])
camera = cv2.VideoCapture(0)
print("[INFO] Press 'q' to quit...")
while True:
success, frame = camera.read()
if not success:
break
annotated_frame, detections = detector.detect_and_draw(frame)
cv2.imshow("Open Vocabulary Discovery (YOLO-World)", annotated_frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
camera.release()
cv2.destroyAllWindows()
if __name__ == "__main__":
main()Specific Object Recognition
opencv_specific_object.py
Recognize taught objects through visual embedding similarity.
"""
Specific Object Recognition (Visual Embeddings)
Run: python opencv_specific_object.py
First teach objects via Object Studio or API.
"""
import cv2
from object_intelligence import ObjectDetector
def main():
detector = ObjectDetector()
detector.set_mode("specific")
camera = cv2.VideoCapture(0)
print("[INFO] Press 'q' to quit...")
while True:
success, frame = camera.read()
if not success:
break
annotated_frame, detections = detector.detect_and_draw(frame)
for det in detections:
if det.get("type") == "specific":
print(f"[RECOGNIZED] {det['label']} | Similarity: {det['confidence']:.2f}")
cv2.imshow("Specific Object Recognition", annotated_frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
camera.release()
cv2.destroyAllWindows()
if __name__ == "__main__":
main()Lock Mode Targeting
opencv_lock_mode.py
Lock onto a specific target and track it persistently.
"""
Lock Mode Target Detection
Run: python opencv_lock_mode.py
"""
import cv2
from object_intelligence import ObjectDetector
def main():
detector = ObjectDetector()
detector.set_mode("combined")
target = "cup"
detector.lock(target)
print(f"[INFO] Lock Mode ON for: '{target}'. Press 'q' to quit...")
camera = cv2.VideoCapture(0)
while True:
success, frame = camera.read()
if not success:
break
annotated_frame, detections = detector.detect_and_draw(frame)
cv2.imshow("Lock Mode Real-Time Feed", annotated_frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
camera.release()
cv2.destroyAllWindows()
if __name__ == "__main__":
main()Combined Multi-Pipeline
opencv_combined.py
Fuse RT-DETR + YOLO-World + Visual Embeddings simultaneously.
"""
Combined Multi-Pipeline Detection & Result Fusion
Run: python opencv_combined.py
"""
import cv2
from object_intelligence import ObjectDetector
def main():
detector = ObjectDetector()
detector.set_mode("combined")
camera = cv2.VideoCapture(0)
print("[INFO] Running Combined Pipeline. Press 'q' to quit...")
while True:
success, frame = camera.read()
if not success:
break
annotated_frame, detections = detector.detect_and_draw(frame)
cv2.imshow("Object Intelligence - Combined Pipeline", annotated_frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
camera.release()
cv2.destroyAllWindows()
if __name__ == "__main__":
main()