当前位置:网站首页>Transformers vit image model vector acquisition
Transformers vit image model vector acquisition
2022-06-22 14:05:00 【loong_ XL】
Reference resources :https://huggingface.co/facebook/dino-vitb16
**** last_hidden_states 197 individual token; This is a 1616 Divide picture 224224, The latter is divided apart from the former 196 individual patch, Add one more transformer The first one added cls token, common 197 individual
from transformers import ViTFeatureExtractor, ViTModel
from PIL import Image
import requests
url = 'http://images.cocodataset.org/val2017/000000039769.jpg'
image = Image.open(requests.get(url, stream=True).raw)
feature_extractor = ViTFeatureExtractor.from_pretrained('facebook/dino-vitb16')
model = ViTModel.from_pretrained('facebook/dino-vitb16')
inputs = feature_extractor(images=image, return_tensors="pt")
outputs = model(**inputs)
last_hidden_states = outputs.last_hidden_state

*** To obtain cls token Vector embedding
边栏推荐
- Ppt data collection methods and analysis skills
- "Dare not doubt the code, but have to doubt the code" a network request timeout analysis
- 3DMAX modeling notes (I): introducing 3DMAX and creating the first model Hello World
- 简简单单的科研秘籍
- 毕业论文写作中致谢词的常见写法及优秀范文
- MySQL如何让一个表中可以有多个自增列
- Docker installing PostgreSQL
- 软件项目验收测试范围和流程,这些你都知道吗?
- What you must understand before you are 30
- How to add a mask to a VR panoramic work? What is the function?
猜你喜欢
MySQL如何让一个表中可以有多个自增列

Stop using system Currenttimemillis() takes too long to count. It's too low. Stopwatch is easy to use!

Leetcode interval DP

如何理解fold change?倍数分析?

"Dare not doubt the code, but have to doubt the code" a network request timeout analysis

CVE-2022-22965复现

如何给VR全景作品添加遮罩?作用是什么?

哈希索引设计发展史

《Kubernetes监控篇:Grafana通过自动化方式添加datasource和dashboard》

Should programmers choose software talent outsourcing companies?
随机推荐
Eureka的InstanceInfoReplicator类(服务注册辅助类)
七牛云上传图片
Detailed explanation of rules and ideas for advance sale of deposit
Triggers in MySQL
Opengauss database source code analysis series articles -- detailed explanation of dense equivalent query technology
[Nacos cloud native] the first step of reading the source code is to start Nacos locally
浅析Redis 切片集群的数据倾斜问题
My suggestions on SAP ABAP transformation
CVE-2022-22965複現
epoch_ Num and predict_ Conversion of num
JS advanced programming version 4: learning iterators
"N'osez pas douter du Code, vous devez douter du Code" notez une analyse de délai de demande réseau
Do you know the scope and process of software project acceptance testing?
How to understand fold change? Multiple analysis?
History of hash index design
Word skills summary
《Kubernetes监控篇:Grafana通过自动化方式添加datasource和dashboard》
Tianrun cloud is about to be listed: VC tycoon Tian Suning significantly reduces his holdings and is expected to cash out HK $260million
聊一聊数据库的行存与列存
Offline physical stores combined with VR panorama make virtual shopping more realistic