You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 1.8 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # Python Dataflow Example
  2. This examples shows how to create and connect dora nodes in Python.
  3. ## Overview
  4. The [`dataflow.yml`](./dataflow.yml) defines a simple dataflow graph with the following three nodes:
  5. - a webcam node, that connects to your webcam and feed the dataflow with webcam frame as jpeg compressed bytearray.
  6. - an object detection node, that apply Yolo v5 on the webcam image. The model is imported from Pytorch Hub. The output
  7. is the bounding box of each object detected, the confidence and the associated label. You can have more info
  8. here: https://pytorch.org/hub/ultralytics_yolov5/
  9. - a window plotting node, that will retrieve the webcam image and the Yolov5 bounding box and join the two together.
  10. The same dataflow is implemented for a `dynamic-node` in [`dataflow_dynamic.yml`](./dataflow_dynamic.yml). It contains
  11. the same nodes as the previous dataflow, but the object detection node is a dynamic node. See the next section for more
  12. information on how to start such a dataflow.
  13. ## Getting started
  14. After installing Rust, `dora-cli` and `Python >3.11`, you will need to **activate** (or create and **activate**) a
  15. virtual
  16. environment. Then, you will need to install the dependencies:
  17. ```bash
  18. cd examples/python-dataflow
  19. dora build ./dataflow.yml (or dora build ./dataflow_dynamic.yml)
  20. ```
  21. It will install the required dependencies for the Python nodes.
  22. Then you can run the dataflow:
  23. ```bash
  24. dora up
  25. dora start ./dataflow.yml (or dora start ./dataflow_dynamic.yml)
  26. ```
  27. **Note**: if you're running the dynamic dataflow, you will need to start manually the ultralytics-yolo node:
  28. ```bash
  29. # activate your virtual environment in another terminal
  30. python ultralytics-yolo --name object-detection --model yolov5n.pt
  31. ```