outputs the video stream and detections via websockets
Constants
DETECTOR =
Detector.new(
INPUT_DEVICE,
INPUT_WIDTH,
INPUT_HEIGHT,
MODEL)
ENABLE_DETECTOR = ENV["ENABLE_DETECTOR"]? == "true"
ENABLE_EDGETPU = ENV["ENABLE_EDGETPU"]? == "true"
ENABLE_REPLAY = ENV["ENABLE_REPLAY"]? == "true"
ENABLE_STREAMING = ENV["ENABLE_STREAMING"]? == "true"
INPUT_DEVICE = Path[ENV["INPUT_DEVICE"]? || "/dev/video0"]
INPUT_HEIGHT = ENV["INPUT_HEIGHT"].to_i
INPUT_WIDTH = ENV["INPUT_WIDTH"].to_i
MODEL = Imagine::Model::TFLiteImage.new(MODEL_LOC, labels: MODEL_LABELS, enable_tpu: ENABLE_EDGETPU)
MODEL_LABELS = ENV["LABELS_URI"]?.presence ? URI.parse(ENV["LABELS_URI"]) : (ENV["LABELS_FILE"]? ? (File.read(ENV["LABELS_FILE"])).split("\n") : nil)
MODEL_LOC = ENV["MODEL_PATH"]?.presence ? Path.new(ENV["MODEL_PATH"]) : URI.parse(ENV["MODEL_URI"])
CPU
MODEL_URI=https://raw.githubusercontent.com/google-coral/test_data/master/efficientdet_lite0_320_ptq.tflite
LABELS_URI=https://raw.githubusercontent.com/google-coral/test_data/master/coco_labels.txt
CORAL
MODEL_URI=https://raw.githubusercontent.com/google-coral/test_data/master/efficientdet_lite0_320_ptq_edgetpu.tflite
MULTICAST_ADDRESS = ENV["MULTICAST_ADDRESS"]
where we want the video to be streamed
MULTICAST_PORT = ENV["MULTICAST_PORT"].to_i
PARSER_LIST = ["application/json"]
outputs the video stream and detections via websockets
REPLAY =
CaptureReplay.new(
REPLAY_MOUNT_PATH,
MULTICAST_ADDRESS,
MULTICAST_PORT)
REPLAY_MOUNT_PATH = Path[ENV["REPLAY_MOUNT_PATH"]? || "/mnt/ramdisk"]
RESPONDER_LIST = ["application/json", "application/yaml", "text/html"]
outputs the video stream and detections via websockets
Class methods
base_route
Helper for obtaining base route
stream(hash_parts : Hash(String | Symbol, Nil | Bool | Int32 | Int64 | Float32 | Float64 | String | Symbol) | Nil = nil, **tuple_parts)
Helper methods for performing redirect_to calls
Instance methods
base_route(*args, **options)
Helper for obtaining base route
base_route(*args, **options, &)
Helper for obtaining base route
detect(socket, include_frame : Bool = false)
Sourcereplay(seconds : UInt32)
Source