Spaces:
Build error
Build error
Iskaj
commited on
Commit
·
9b8a658
1
Parent(s):
727e567
remove unused imports
Browse files- plot.py +1 -5
- videomatch.py +2 -3
plot.py
CHANGED
@@ -1,13 +1,9 @@
|
|
1 |
-
import time
|
2 |
-
|
3 |
import numpy as np
|
4 |
import pandas as pd
|
5 |
import seaborn as sns
|
6 |
import matplotlib.pyplot as plt
|
7 |
from scipy import stats as st
|
8 |
|
9 |
-
from config import FPS
|
10 |
-
|
11 |
def change_points_to_segments(df, change_points):
|
12 |
""" Convert change points from kats detector to segment indicators.
|
13 |
|
@@ -55,7 +51,7 @@ def plot_segment_comparison(df, change_points, video_mp4 = "Placeholder.mp4", vi
|
|
55 |
Returns:
|
56 |
fig (Figure): Figure that shows the comparison between two videos.
|
57 |
segment_decisions (dict): JSON-style dictionary containing the decision information of the comparison between two videos.
|
58 |
-
|
59 |
"""
|
60 |
# Plot it with certain characteristics
|
61 |
fig, ax_arr = plt.subplots(4, 1, figsize=(16, 6), dpi=300, sharex=True)
|
|
|
|
|
|
|
1 |
import numpy as np
|
2 |
import pandas as pd
|
3 |
import seaborn as sns
|
4 |
import matplotlib.pyplot as plt
|
5 |
from scipy import stats as st
|
6 |
|
|
|
|
|
7 |
def change_points_to_segments(df, change_points):
|
8 |
""" Convert change points from kats detector to segment indicators.
|
9 |
|
|
|
51 |
Returns:
|
52 |
fig (Figure): Figure that shows the comparison between two videos.
|
53 |
segment_decisions (dict): JSON-style dictionary containing the decision information of the comparison between two videos.
|
54 |
+
|
55 |
"""
|
56 |
# Plot it with certain characteristics
|
57 |
fig, ax_arr = plt.subplots(4, 1, figsize=(16, 6), dpi=300, sharex=True)
|
videomatch.py
CHANGED
@@ -1,6 +1,5 @@
|
|
1 |
import os
|
2 |
import logging
|
3 |
-
import json
|
4 |
import faiss
|
5 |
|
6 |
from kats.detectors.cusum_detection import CUSUMDetector
|
@@ -13,7 +12,7 @@ import numpy as np
|
|
13 |
import pandas as pd
|
14 |
|
15 |
from videohash import compute_hashes, filepath_from_url
|
16 |
-
from config import FPS,
|
17 |
|
18 |
def index_hashes_for_video(url: str) -> faiss.IndexBinaryIVF:
|
19 |
""" Compute hashes of a video and index the video using faiss indices and return the index.
|
@@ -92,7 +91,7 @@ def compare_videos(hash_vectors, target_index, MIN_DISTANCE = 3):
|
|
92 |
D (ndarray): distances of the vectors within a radius around the query point
|
93 |
I (ndarray): indices of the neighbours
|
94 |
hash_vectors (ndarray): vector of the indexed frames that can be searched.
|
95 |
-
|
96 |
"""
|
97 |
lims, D, I = target_index.range_search(hash_vectors, MIN_DISTANCE)
|
98 |
return lims, D, I, hash_vectors
|
|
|
1 |
import os
|
2 |
import logging
|
|
|
3 |
import faiss
|
4 |
|
5 |
from kats.detectors.cusum_detection import CUSUMDetector
|
|
|
12 |
import pandas as pd
|
13 |
|
14 |
from videohash import compute_hashes, filepath_from_url
|
15 |
+
from config import FPS, ROLLING_WINDOW_SIZE
|
16 |
|
17 |
def index_hashes_for_video(url: str) -> faiss.IndexBinaryIVF:
|
18 |
""" Compute hashes of a video and index the video using faiss indices and return the index.
|
|
|
91 |
D (ndarray): distances of the vectors within a radius around the query point
|
92 |
I (ndarray): indices of the neighbours
|
93 |
hash_vectors (ndarray): vector of the indexed frames that can be searched.
|
94 |
+
|
95 |
"""
|
96 |
lims, D, I = target_index.range_search(hash_vectors, MIN_DISTANCE)
|
97 |
return lims, D, I, hash_vectors
|