Spaces:
Build error
Build error
added missing parameter fps in track_video
Browse files- inference.py +3 -3
inference.py
CHANGED
|
@@ -175,7 +175,7 @@ class ObjectTrackerInference:
|
|
| 175 |
inter=(xr-xl)*(yb-yt)
|
| 176 |
return inter/(w1*h1+w2*h2-inter)
|
| 177 |
|
| 178 |
-
def track_video(self, video_path, init_bbox, output_path='tracked_output.mp4'):
|
| 179 |
print(f"Opening video: {video_path}")
|
| 180 |
|
| 181 |
try:
|
|
@@ -188,11 +188,11 @@ class ObjectTrackerInference:
|
|
| 188 |
print(f"Video: {w}x{h}, {total_frames} frames")
|
| 189 |
|
| 190 |
fourcc = cv2.VideoWriter_fourcc(*'avc1')
|
| 191 |
-
out=cv2.VideoWriter(output_path, fourcc,
|
| 192 |
|
| 193 |
if not out.isOpened():
|
| 194 |
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
|
| 195 |
-
out=cv2.VideoWriter(output_path, fourcc,
|
| 196 |
|
| 197 |
# Reset state
|
| 198 |
self.motion.prev_frame = None
|
|
|
|
| 175 |
inter=(xr-xl)*(yb-yt)
|
| 176 |
return inter/(w1*h1+w2*h2-inter)
|
| 177 |
|
| 178 |
+
def track_video(self, video_path, init_bbox, output_path='tracked_output.mp4', fps=30):
|
| 179 |
print(f"Opening video: {video_path}")
|
| 180 |
|
| 181 |
try:
|
|
|
|
| 188 |
print(f"Video: {w}x{h}, {total_frames} frames")
|
| 189 |
|
| 190 |
fourcc = cv2.VideoWriter_fourcc(*'avc1')
|
| 191 |
+
out=cv2.VideoWriter(output_path, fourcc, fps, (w,h))
|
| 192 |
|
| 193 |
if not out.isOpened():
|
| 194 |
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
|
| 195 |
+
out=cv2.VideoWriter(output_path, fourcc, fps, (w,h))
|
| 196 |
|
| 197 |
# Reset state
|
| 198 |
self.motion.prev_frame = None
|