Update app.py
Browse files
app.py
CHANGED
@@ -30,7 +30,7 @@ label_color_dict = {}
|
|
30 |
|
31 |
def query_data(in_pil_img: Image.Image):
|
32 |
results = detector(in_pil_img)
|
33 |
-
print(f"检测结果:{results}")
|
34 |
return results
|
35 |
|
36 |
|
@@ -105,7 +105,7 @@ def process_video(input_video_path):
|
|
105 |
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
106 |
output_video_filename = f"output_{timestamp}.mp4"
|
107 |
output_video_path = os.path.join(output_dir, output_video_filename)
|
108 |
-
print(f"输出视频信息:{output_video_path}, {width}x{height}, {fps}fps")
|
109 |
out = cv2.VideoWriter(output_video_path, fourcc, fps, (width, height))
|
110 |
|
111 |
while True:
|
@@ -115,15 +115,15 @@ def process_video(input_video_path):
|
|
115 |
|
116 |
rgb_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
|
117 |
pil_image = Image.fromarray(rgb_frame)
|
118 |
-
print(f"Input frame of shape {rgb_frame.shape} and type {rgb_frame.dtype}") # 调试信息
|
119 |
annotated_frame = get_annotated_image(pil_image)
|
120 |
bgr_frame = cv2.cvtColor(annotated_frame, cv2.COLOR_RGB2BGR)
|
121 |
-
print(f"Annotated frame of shape {bgr_frame.shape} and type {bgr_frame.dtype}") # 调试信息
|
122 |
# 确保帧的尺寸与视频输出一致
|
123 |
if bgr_frame.shape[:2] != (height, width):
|
124 |
bgr_frame = cv2.resize(bgr_frame, (width, height))
|
125 |
|
126 |
-
print(f"Writing frame of shape {bgr_frame.shape} and type {bgr_frame.dtype}") # 调试信息
|
127 |
out.write(bgr_frame)
|
128 |
|
129 |
cap.release()
|
|
|
30 |
|
31 |
def query_data(in_pil_img: Image.Image):
|
32 |
results = detector(in_pil_img)
|
33 |
+
# print(f"检测结果:{results}")
|
34 |
return results
|
35 |
|
36 |
|
|
|
105 |
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
106 |
output_video_filename = f"output_{timestamp}.mp4"
|
107 |
output_video_path = os.path.join(output_dir, output_video_filename)
|
108 |
+
# print(f"输出视频信息:{output_video_path}, {width}x{height}, {fps}fps")
|
109 |
out = cv2.VideoWriter(output_video_path, fourcc, fps, (width, height))
|
110 |
|
111 |
while True:
|
|
|
115 |
|
116 |
rgb_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
|
117 |
pil_image = Image.fromarray(rgb_frame)
|
118 |
+
# print(f"Input frame of shape {rgb_frame.shape} and type {rgb_frame.dtype}") # 调试信息
|
119 |
annotated_frame = get_annotated_image(pil_image)
|
120 |
bgr_frame = cv2.cvtColor(annotated_frame, cv2.COLOR_RGB2BGR)
|
121 |
+
# print(f"Annotated frame of shape {bgr_frame.shape} and type {bgr_frame.dtype}") # 调试信息
|
122 |
# 确保帧的尺寸与视频输出一致
|
123 |
if bgr_frame.shape[:2] != (height, width):
|
124 |
bgr_frame = cv2.resize(bgr_frame, (width, height))
|
125 |
|
126 |
+
# print(f"Writing frame of shape {bgr_frame.shape} and type {bgr_frame.dtype}") # 调试信息
|
127 |
out.write(bgr_frame)
|
128 |
|
129 |
cap.release()
|