dodo_detector package

dodo_detector.detection module

class dodo_detector.detection.KeypointObjectDetector(database_path, detector_type='RootSIFT', matcher_type='BF', min_points=10, logging=False)[source]

Bases: dodo_detector.detection.ObjectDetector

Object detector based on keypoints. This class depends on OpenCV SIFT and SURF feature detection algorithms, as well as the brute-force and FLANN-based feature matchers.

Parameters:
  • database_path – Path to the top-level directory containing subdirectories, each subdirectory named after a class of objects and containing images of that object.
  • detector_type – either SURF, SIFT or RootSIFT
  • matcher_type – either BF for brute-force matcher or FLANN for flann-based matcher
  • min_points – minimum number of keypoints necessary for an object to be considered detected in an image
categories
database_path
detector_type
from_image(frame)[source]

Detects objects in an image

Parameters:frame – a numpy.ndarray containing the image where objects will be detected
Returns:a tuple containing the image, with objects marked by rectangles, and a dictionary listing objects and their locations as (ymin, xmin, ymax, xmax)
matcher_type
class dodo_detector.detection.ObjectDetector[source]

Bases: object

Base class for object detectors used by the package.

from_camera(camera_id=0)[source]

Detects objects in frames from a camera feed

Parameters:camera_id – the ID of the camera in the system
from_image(frame)[source]

Detects objects in an image

Parameters:frame – a numpy.ndarray containing the image where objects will be detected
Returns:a tuple containing the image, with objects marked by rectangles, and a dictionary listing objects and their locations as (ymin, xmin, ymax, xmax)
from_video(filepath)[source]

Detects objects in frames from a video file

Parameters:filepath – the path to the video file
class dodo_detector.detection.SingleShotDetector(path_to_frozen_graph, path_to_labels, num_classes=None, confidence=0.8)[source]

Bases: dodo_detector.detection.ObjectDetector

Object detector powered by the TensorFlow Object Detection API.

Parameters:
  • path_to_frozen_graph – path to the frozen inference graph file, a file with a .pb extension.
  • path_to_labels – path to the label map, a text file with the .pbtxt extension.
  • num_classes – number of object classes that will be detected. If None, it will be guessed by the contents of the label map.
  • confidence – a value between 0 and 1 representing the confidence level the network has in the detection to consider it an actual detection.
categories
confidence
from_image(frame)[source]

Detects objects in an image

Parameters:frame – a numpy.ndarray containing the image where objects will be detected
Returns:a tuple containing the image, with objects marked by rectangles, and a dictionary listing objects and their locations as (ymin, xmin, ymax, xmax)