Comments (3)
import towhee
import time
# Please note the first time run will take time to download model and other files.
start = time.time()
collection = create_milvus_collection('timesformer', 768)
dc = (
towhee.read_csv('reverse_video_search.csv')
.runas_op['id', 'id'](func=lambda x: int(x))
.video_decode.ffmpeg['path', 'frames'](sample_type='uniform_temporal_subsample', args={'num_samples': 8})
.action_classification['frames', ('labels', 'scores', 'vec')].timesformer(skip_preprocess=True)
.tensor_normalize['vec', 'vec']()
.to_milvus['id', 'vec'](collection=collection, batch=10)
)
end = time.time()
print('Total insert time: %.2fs'%(end-start))
print('Total number of inserted data is {}.'.format(collection.num_entities))
start = time.time()
benchmark = (
towhee.glob['path']('./test/*/*.mp4')
.video_decode.ffmpeg['path', 'frames'](sample_type='uniform_temporal_subsample', args={'num_samples': 8})
.action_classification['frames', ('labels', 'scores', 'vec')].timesformer(skip_preprocess=True)
.tensor_normalize['vec', 'vec']()
.milvus_search['vec', 'result'](collection=collection, limit=10)
.runas_op['path', 'ground_truth'](func=ground_truth)
.runas_op['result', 'result'](func=lambda res: [x.id for x in res])
.with_metrics(['mean_hit_ratio', 'mean_average_precision'])
.evaluate['ground_truth', 'result']('timesformer')
.report()
)
end = time.time()
print('Total search time: %.2fs'%(end-start))
from examples.
import towhee import time # Please note the first time run will take time to download model and other files. start = time.time() collection = create_milvus_collection('timesformer', 768) dc = ( towhee.read_csv('reverse_video_search.csv') .runas_op['id', 'id'](func=lambda x: int(x)) .video_decode.ffmpeg['path', 'frames'](sample_type='uniform_temporal_subsample', args={'num_samples': 8}) .action_classification['frames', ('labels', 'scores', 'vec')].timesformer(skip_preprocess=True) .tensor_normalize['vec', 'vec']() .to_milvus['id', 'vec'](collection=collection, batch=10) ) end = time.time() print('Total insert time: %.2fs'%(end-start)) print('Total number of inserted data is {}.'.format(collection.num_entities)) start = time.time() benchmark = ( towhee.glob['path']('./test/*/*.mp4') .video_decode.ffmpeg['path', 'frames'](sample_type='uniform_temporal_subsample', args={'num_samples': 8}) .action_classification['frames', ('labels', 'scores', 'vec')].timesformer(skip_preprocess=True) .tensor_normalize['vec', 'vec']() .milvus_search['vec', 'result'](collection=collection, limit=10) .runas_op['path', 'ground_truth'](func=ground_truth) .runas_op['result', 'result'](func=lambda res: [x.id for x in res]) .with_metrics(['mean_hit_ratio', 'mean_average_precision']) .evaluate['ground_truth', 'result']('timesformer') .report() ) end = time.time() print('Total search time: %.2fs'%(end-start))
![]()
You need to install the correct towhee version, which at least include https://github.com/towhee-io/towhee/blob/main/towhee/types/video_frame.py (commit 7e8be9ad2)
from examples.
Verified, close issue
from examples.
Related Issues (20)
- code needs to be modified HOT 2
- The url path in the example of image_animation is invalid now HOT 1
- Model not loading in 1_build_question_answering_engine.ipynb HOT 4
- Read image Error failed HOT 9
- Loading Local Models and Downloading Online Models HOT 2
- please explain what entity does the "results" refer to in the code snippet HOT 2
- TypeError: 'PretrainedCfg' object is not subscriptable HOT 6
- RuntimeError: Node-video-copy-detection/temporal-network-7 runs failed, error msg: module 'numpy' has no attribute 'bool'. HOT 3
- text_image_search demo clip_op.train error HOT 1
- Error: CollectionNotExists for example text-to-text search HOT 3
- Collection returns empty in question answering engine. HOT 3
- Use clip to load local model HOT 1
- MilvusException: <MilvusException: (code=2, message=Fail connecting to server on 127.0.0.1:19530. Timeout)> HOT 2
- 以图搜图如何使用自己的模型 HOT 8
- How to free GPU memory HOT 1
- RuntimeError: Loading operator with error:Load operator failed HOT 5
- how to ensure that the model is only loaded once when extracting feature vectors HOT 1
- TypeError: 'torch._C.Node' object is not subscriptable HOT 2
- huggingface_hub.utils._errors.LocalEntryNotFoundError ... HOT 4
- 数据存放失败 HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from examples.