logo
Browse Source

update readme with dc2

main
ChengZi 2 years ago
parent
commit
8b9c8f5cb8
  1. 48
      README.md

48
README.md

@ -18,41 +18,57 @@ This operator select input list by simply aggregating, sorting and then filterin
For two input lists: video urls and scores, aggregate url by reduce_function, then sort aggregated scores, then select top k results.
```python
import towhee
from towhee.dc2 import pipe, ops, DataCollection
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()
p = (
pipe.input('video_urls', 'scores') \
.map(('video_urls', 'scores'), 'res', ops.video_copy_detection.select_video(top_k=2, reduce_function='mean', reverse=True)) \
.output('video_urls', 'scores', 'res')
)
DataCollection(p(['a', 'a', 'c', 'a', 'b', 'b', 'c', 'c'], [2, 8, 9.3, 5, 2, 1, 0, -1])).show()
```
![](mean.png)
```python
import towhee
from towhee.dc2 import pipe, ops, DataCollection
p = (
pipe.input('video_urls', 'scores') \
.map(('video_urls', 'scores'), 'res', ops.video_copy_detection.select_video(top_k=2, reduce_function='sum', reverse=True)) \
.output('video_urls', 'scores', 'res')
)
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()
DataCollection(p(['a', 'a', 'c', 'a', 'b', 'b', 'c', 'c'], [2, 8, 9.3, 5, 2, 1, 0, -1])).show()
```
![](mean.png)
```python
import towhee
from towhee.dc2 import pipe, ops, DataCollection
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()
p = (
pipe.input('video_urls', 'scores') \
.map(('video_urls', 'scores'), 'res', ops.video_copy_detection.select_video(top_k=2, reduce_function='max', reverse=True)) \
.output('video_urls', 'scores', 'res')
)
DataCollection(p(['a', 'a', 'c', 'a', 'b', 'b', 'c', 'c'], [2, 8, 9.3, 5, 2, 1, 0, -1])).show()
```
![](max.png)
```python
import towhee
from towhee.dc2 import pipe, ops, DataCollection
p = (
pipe.input('video_urls', 'scores') \
.map(('video_urls', 'scores'), 'res', ops.video_copy_detection.select_video(top_k=2, reduce_function='min', reverse=True)) \
.output('video_urls', 'scores', 'res')
)
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()
DataCollection(p(['a', 'a', 'c', 'a', 'b', 'b', 'c', 'c'], [2, 8, 9.3, 5, 2, 1, 0, -1])).show()
```
![](min.png)

Loading…
Cancel
Save