|
@ -17,16 +17,20 @@ This operator can compare two ordered sequences, then detect the range which fea |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```python |
|
|
```python |
|
|
import towhee |
|
|
|
|
|
|
|
|
from towhee.dc2 import pipe, ops, DataCollection |
|
|
import numpy as np |
|
|
import numpy as np |
|
|
|
|
|
|
|
|
# simulate a video feature by 10 frames of 512d vectors. |
|
|
# simulate a video feature by 10 frames of 512d vectors. |
|
|
videos_embeddings = np.random.randn(10,512) |
|
|
videos_embeddings = np.random.randn(10,512) |
|
|
videos_embeddings = videos_embeddings / np.linalg.norm(videos_embeddings,axis=1).reshape(10,-1) |
|
|
videos_embeddings = videos_embeddings / np.linalg.norm(videos_embeddings,axis=1).reshape(10,-1) |
|
|
|
|
|
|
|
|
towhee.dc['src','dest']([[videos_embeddings,videos_embeddings]]) \ |
|
|
|
|
|
.video_copy_detection.temporal_network[('src','dest'), ('range', 'range_score')]() \ |
|
|
|
|
|
.show() |
|
|
|
|
|
|
|
|
p = ( |
|
|
|
|
|
pipe.input('src', 'dest') \ |
|
|
|
|
|
.map(('src', 'dest'), ('range', 'range_score'), ops.video_copy_detection.temporal_network()) \ |
|
|
|
|
|
.output('src', 'dest', 'range', 'range_score') |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
DataCollection(p(videos_embeddings, videos_embeddings)).show() |
|
|
``` |
|
|
``` |
|
|
|
|
|
|
|
|
<img src="./tabular.png" alt="result" style="height:60px;"/> |
|
|
<img src="./tabular.png" alt="result" style="height:60px;"/> |
|
|