select-video
copied
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Readme
Files and versions
Updated 2 years ago
video-copy-detection
Select video
author: Chen Zhang
Description
This operator select input list by simply aggregating, sorting and then filtering it.
Code Example
For two input lists: video urls and scores, aggregate url by reduce_function, then sort aggregated scores, then select top k results.
import towhee
towhee.dc['video_urls', 'scores']([[['a', 'a', 'c', 'a', 'b', 'b', 'c', 'c'], [2, 8, 9.3, 5, 2, 1, 0, -1]]])\
.video_copy_detection.select_video[('video_urls','scores'), 'res'](top_k=2, reduce_function='mean', reverse=True)\
.show()
import towhee
towhee.dc['video_urls', 'scores']([[['a', 'a', 'c', 'a', 'b', 'b', 'c', 'c'], [2, 8, 9.3, 5, 2, 1, 0, -1]]])\
.video_copy_detection.select_video[('video_urls','scores'), 'res'](top_k=2, reduce_function='sum', reverse=True)\
.show()
import towhee
towhee.dc['video_urls', 'scores']([[['a', 'a', 'c', 'a', 'b', 'b', 'c', 'c'], [2, 8, 9.3, 5, 2, 1, 0, -1]]])\
.video_copy_detection.select_video[('video_urls','scores'), 'res'](top_k=2, reduce_function='max', reverse=True)\
.show()
import towhee
towhee.dc['video_urls', 'scores']([[['a', 'a', 'c', 'a', 'b', 'b', 'c', 'c'], [2, 8, 9.3, 5, 2, 1, 0, -1]]])\
.video_copy_detection.select_video[('video_urls','scores'), 'res'](top_k=2, reduce_function='min', reverse=True)\
.show()
Factory Constructor
Create the operator via the following factory method
select_video(top_k: int, reduce_function: str, reverse: bool)
Parameters:
top_k: int
Select top k result.
reduce_function: str
Aggregate function name, support name:
- sum
- mean
- max
- min
reverse: bool
Whether sorted result is reversed.
Interface
Parameters:
video_urls: List[str]
Video urls.
scores: List[float]
Every video scores.
Returns: List[str]
Selected video url results.
ChengZi
7f2e13d1cd
| 3 Commits | ||
---|---|---|---|
.gitattributes |
1.1 KiB
|
2 years ago | |
README.md |
2.0 KiB
|
2 years ago | |
__init__.py |
756 B
|
2 years ago | |
max.png |
16 KiB
|
2 years ago | |
mean.png |
16 KiB
|
2 years ago | |
min.png |
16 KiB
|
2 years ago | |
select_video.py |
2.5 KiB
|
2 years ago |