005968dcfbd2a8f70d8ea3957c8abba60a12492d,pliers/filters/video.py,FrameSamplingFilter,_filter,#FrameSamplingFilter#,38
Before Change
new_idx = range(int(video.fps * video.clip.duration))[::self.every]
elif self.hertz is not None:
interval = int(video.fps / self.hertz)
new_idx = range(int(video.fps * video.clip.duration))[::interval]
elif self.top_n is not None:
import cv2
diffs = []
for i, img in enumerate(video.frames):
if i == 0:
last = img
continue
diffs.append(sum(cv2.sumElems(cv2.absdiff(last.data, img.data))))
last = img
new_idx = sorted(range(len(diffs)),
key=lambda i: diffs[i],
reverse=True)[:self.top_n]
frame_index = sorted(list(set(video.frame_index).intersection(new_idx)))
return VideoFrameCollectionStim(filename=video.filename,
clip=video.clip,
frame_index=frame_index)
After Change
super(FrameSamplingFilter, self).__init__()
def _filter(self, video):
if not isinstance(video, VideoStim):
raise TypeError("Currently, frame sampling is only supported for "
"complete VideoStim inputs.")
if self.every is not None:
new_idx = range(video.n_frames)[::self.every]
elif self.hertz is not None:
interval = video.fps / float(self.hertz)
new_idx = np.arange(0, video.n_frames, interval).astype(int)
new_idx = list(new_idx)
elif self.top_n is not None:
import cv2
diffs = []
for i, img in enumerate(video.frames):
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 5
Instances
Project Name: tyarkoni/pliers
Commit Name: 005968dcfbd2a8f70d8ea3957c8abba60a12492d
Time: 2018-05-15
Author: quinten.mcnamara@gmail.com
File Name: pliers/filters/video.py
Class Name: FrameSamplingFilter
Method Name: _filter
Project Name: tensorly/tensorly
Commit Name: 8be82ddbdc148b8c1505e479a4a37faad020c0a6
Time: 2021-02-25
Author: caglayantun@gmail.com
File Name: tensorly/decomposition/_nn_cp.py
Class Name:
Method Name: non_negative_parafac_hals
Project Name: mindsdb/mindsdb
Commit Name: 1598381b2bed5d2d8fc95ebce957516d6f4c5463
Time: 2021-02-20
Author: stpmax@yandex.ru
File Name: mindsdb/api/mysql/mysql_proxy/mysql_proxy.py
Class Name: MysqlProxy
Method Name: initSession