Skip to content

Commit 2b95b6b

Browse files
committed
Add deep video test
1 parent 3863ac2 commit 2b95b6b

File tree

7 files changed

+28
-2
lines changed

7 files changed

+28
-2
lines changed
123 KB
Loading
158 KB
Loading
182 KB
Loading
181 KB
Loading
182 KB
Loading
4.24 MB
Binary file not shown.

tests/test_video.py

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
import subprocess
22
import time
33
from pathlib import Path
4-
4+
import tempfile
55
import superannotate as sa
6+
from superannotate.db.projects import _extract_frames_from_video
7+
import os
8+
import numpy as np
9+
import cv2 as cv
610

711
PROJECT_NAME1 = "test video upload1"
812
PROJECT_NAME2 = "test video upload2"
@@ -51,4 +55,26 @@ def test_video(tmpdir):
5155

5256
assert len(sa.search_images(PROJECT_NAME2 + "/new folder")) == len(
5357
sa.search_images(PROJECT_NAME2)
54-
)
58+
)
59+
60+
61+
def test_video_deep():
62+
tempdir = tempfile.TemporaryDirectory()
63+
_extract_frames_from_video(
64+
start_time=0.0,
65+
end_time=None,
66+
video_path="./tests/sample_videos/single/video.mp4",
67+
tempdir=tempdir,
68+
limit=10,
69+
target_fps=1
70+
)
71+
temp_dir_name = tempdir.name
72+
ground_truth_dir_name = "./tests/sample_videos/single/ground_truth_frames"
73+
temp_files = os.listdir(temp_dir_name)
74+
for file_name in temp_files:
75+
temp_file_path = temp_dir_name + "/" + file_name
76+
truth_file_path = ground_truth_dir_name + "/" + file_name
77+
img1 = cv.imread(temp_file_path)
78+
img2 = cv.imread(truth_file_path)
79+
diff = np.sum(img2 - img1) + np.sum(img2 - img1)
80+
assert diff == 0

0 commit comments

Comments
 (0)