Browse Source

Fix `pylint` warning

tags/v0.3.6-rc0
haixuanTao 1 year ago
parent
commit
b8d2e5560f
3 changed files with 10 additions and 8 deletions
  1. +4
    -4
      node-hub/opencv-plot/opencv_plot/main.py
  2. +2
    -2
      node-hub/opencv-video-capture/opencv_video_capture/main.py
  3. +4
    -2
      node-hub/ultralytics-yolo/ultralytics_yolo/main.py

+ 4
- 4
node-hub/opencv-plot/opencv_plot/main.py View File

@@ -1,6 +1,6 @@
import os
import argparse
import cv2
from cv2 import cv2 # Importing cv2 this way remove error warnings``

import numpy as np
import pyarrow as pa
@@ -13,7 +13,7 @@ RUNNER_CI = True if os.getenv("CI") == "true" else False
class Plot:
frame: np.array = np.array([])

bboxes: {} = {
bboxes: dict = {
"bbox": np.array([]),
"conf": np.array([]),
"names": np.array([]),
@@ -136,7 +136,7 @@ def main():
channels = 3
storage_type = np.uint8
else:
raise Exception(f"Unsupported image encoding: {encoding}")
raise RuntimeError(f"Unsupported image encoding: {encoding}")

image = {
"width": np.uint32(arrow_image["width"].as_py()),
@@ -164,7 +164,7 @@ def main():
elif event_id == "text":
plot.text = event["value"][0].as_py()
elif event_type == "ERROR":
raise Exception(event["error"])
raise RuntimeError(event["error"])


if __name__ == "__main__":


+ 2
- 2
node-hub/opencv-video-capture/opencv_video_capture/main.py View File

@@ -1,6 +1,6 @@
import os
import argparse
import cv2
from cv2 import cv2 # Importing cv2 this way remove error warnings``

import numpy as np
import pyarrow as pa
@@ -115,7 +115,7 @@ def main():
node.send_output("image", pa.array([image]), event["metadata"])

elif event_type == "ERROR":
raise Exception(event["error"])
raise RuntimeError(event["error"])


if __name__ == "__main__":


+ 4
- 2
node-hub/ultralytics-yolo/ultralytics_yolo/main.py View File

@@ -52,7 +52,7 @@ def main():
channels = 3
storage_type = np.uint8
else:
raise Exception(f"Unsupported image encoding: {encoding}")
raise RuntimeError(f"Unsupported image encoding: {encoding}")

image = {
"width": np.uint32(arrow_image["width"].as_py()),
@@ -68,6 +68,8 @@ def main():

if encoding == "bgr8":
frame = frame[:, :, ::-1] # OpenCV image (BGR to RGB)
else:
raise RuntimeError(f"Unsupported image encoding: {encoding}")

results = model(frame, verbose=False) # includes NMS

@@ -90,7 +92,7 @@ def main():
)

elif event_type == "ERROR":
raise Exception(event["error"])
raise RuntimeError(event["error"])


if __name__ == "__main__":


Loading…
Cancel
Save