help me in fixing this error!! [module 'supervision' has no attribute 'PolygonZone'] #487
Abhijnan-Maji
started this conversation in
General
Replies: 2 comments 1 reply
-
Any solution to this issue |
Beta Was this translation helpful? Give feedback.
0 replies
-
What version of Supervision did you install? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
import numpy as np
import supervision as sv
initiate polygon zone
polygon = np.array([
[200, 3840],
[1300, 600],
[1325, 600],
[550, 3840]
])
video_info = sv.VideoInfo.from_video_path(SUBWAY_VIDEO_PATH)
zone = sv.PolygonZone(polygon=polygon, frame_resolution_wh=video_info.resolution_wh)
initiate annotators
box_annotator = sv.BoxAnnotator(thickness=4, text_thickness=4, text_scale=2)
zone_annotator = sv.PolygonZoneAnnotator(zone=zone, color=sv.Color.white(), thickness=6, text_thickness=6, text_scale=4)
def process_frame(frame: np.ndarray, i: int) -> np.ndarray:
print('frame', i)
# detect
outputs = predictor(frame)
detections = sv.Detections(
xyxy=outputs["instances"].pred_boxes.tensor.cpu().numpy(),
confidence=outputs["instances"].scores.cpu().numpy(),
class_id=outputs["instances"].pred_classes.cpu().numpy().astype(int)
)
detections = detections[detections.class_id == 0]
zone.trigger(detections=detections)
sv.process_video(source_path=SUBWAY_VIDEO_PATH, target_path=f"{HOME}/subway-result.mp4", callback=process_frame)
from IPython import display
display.clear_output()
error:
module 'supervision' has no attribute 'PolygonZone'
Beta Was this translation helpful? Give feedback.
All reactions