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.9 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. # Dora Node for plotting data with OpenCV
  2. This node is used to plot a text and a list of bbox on a base image (ideal for object detection).
  3. # YAML
  4. ```yaml
  5. - id: opencv-plot
  6. build: pip install ../../node-hub/opencv-plot
  7. path: opencv-plot
  8. inputs:
  9. # image: Arrow array of size 1 containing the base image
  10. # bbox: Arrow array of bbox
  11. # text: Arrow array of size 1 containing the text to be plotted
  12. env:
  13. PLOT_WIDTH: 640 # optional, default is image input width
  14. PLOT_HEIGHT: 480 # optional, default is image input height
  15. ```
  16. # Inputs
  17. - `image`: Arrow array containing the base image
  18. ```python
  19. image: {
  20. "width": np.uint32,
  21. "height": np.uint32,
  22. "encoding": bytes,
  23. "data": np.array # flattened image data
  24. }
  25. encoded_image = pa.array([image])
  26. decoded_image = {
  27. "width": np.uint32(encoded_image[0]["width"]),
  28. "height": np.uint32(encoded_image[0]["height"]),
  29. "encoding": encoded_image[0]["encoding"].as_py(),
  30. "data": encoded_image[0]["data"].values.to_numpy().astype(np.uint8)
  31. }
  32. ```
  33. - `bbox`: an arrow array containing the bounding boxes, confidence scores, and class names of the detected objects
  34. ```Python
  35. bbox: {
  36. "bbox": np.array, # flattened array of bounding boxes
  37. "conf": np.array, # flat array of confidence scores
  38. "names": np.array, # flat array of class names
  39. }
  40. encoded_bbox = pa.array([bbox])
  41. decoded_bbox = {
  42. "bbox": encoded_bbox[0]["bbox"].values.to_numpy().reshape(-1, 3),
  43. "conf": encoded_bbox[0]["conf"].values.to_numpy(),
  44. "names": encoded_bbox[0]["names"].values.to_numpy(zero_copy_only=False),
  45. }
  46. ```
  47. - `text`: Arrow array containing the text to be plotted
  48. ```python
  49. text: str
  50. encoded_text = pa.array([text])
  51. decoded_text = encoded_text[0].as_py()
  52. ```
  53. ## License
  54. This project is licensed under Apache-2.0. Check out [NOTICE.md](../../NOTICE.md) for more information.