-
Notifications
You must be signed in to change notification settings - Fork 0
/
RTObjectDetection.lf
39 lines (37 loc) · 1.45 KB
/
RTObjectDetection.lf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/**
* @file RTObjectDetection.lf
* @author Vincenzo Barbuto
* @brief Examples of how to perform real-time object detection using a TensorFlow Lite model.
*/
target Python {
keepalive: true,
single-threaded: true # OpenCV crashes if we use the multithreaded version.
}
import Camera from "lib/Input.lf"
import DetectionVisualizer from "lib/Display.lf"
import ObjectDetector from "lib/ComputerVision.lf"
/**
* @brief This reactor tests the object detection functionality by connecting a Camera, an
* ObjectDetectior, and a DetectionVisualizer reactor.
*
* The `DetectionVisualizer` reactor receives the detections results and inference time from the
* `ObjectDetector`, shows detectios results in a video window and prints the inference time to the
* console.
*
* The `main` reactor creates instances of the `Camera`, `ObjectDetector`, and `DetectionVisualizer`
* reactors, and connects them together to form the test pipeline.
*
* @note Remember to set the `model` parameter to the absolute path of the object detection model
* you want to use.
*/
main reactor {
camera = new Camera()
display = new DetectionVisualizer()
obj = new ObjectDetector(
model = {= os.path.join(os.getcwd(),"models/vision/detection/ssd_mobilenet_v1.tflite") =})
camera.camera_frame -> display.original_frame
camera.camera_frame ~> camera.trigger
camera.camera_frame -> obj.input_data
obj.inference_time -> display.inference_time
obj.results -> display.results
}