当前位置:网站首页>transforms.RandomCrop()的输入只能是PIL image 不能是tensor
transforms.RandomCrop()的输入只能是PIL image 不能是tensor
2022-06-26 17:43:00 【LIZHEMGHONG】
这是原始代码
报错:TypeError: ‘builtin_function_or_method’ object is not iterable
这是更改后的代码
报错:TypeError: img should be PIL Image. Got <class ‘torch.Tensor’>
所以我输入tensor是不对的,应该输入PIL image
然而我看网上好多资料说这个函数对tensor和PIL都可以,不知道哪个是对的,我感觉应该是只能输入PIL image不能是tensor
我把输入替换成data_i_pil = transforms.ToPILImage()(data_i)后程序可以正常运行
网上好多说这个函数对tensor和PIL都可以,其实不是的,我举个例子,下面的链接就是其中之一
链接:https://www.jianshu.com/p/ae695df39274
边栏推荐
- 腾讯钱智明:信息流业务中的预训练方法探索与应用实践
- Prometeus 2.34.0 new features
- Redis' 43 serial cannons, try how many you can carry
- ZCMU--1367: Data Structure
- Prometeus 2.34.0 新特性
- 正则匹配相同字符
- When I was in the library, I thought of the yuan sharing mode
- Platform management background and merchant menu resource management: merchant registration management design
- ACL 2022 | 基于神经标签搜索的零样本多语言抽取式文本摘要
- Cache breakdown! Don't even know how to write code???
猜你喜欢

Turtle cartography

Niuke network: Design LRU cache structure design LFU cache structure

宝藏又小众的CTA动画素材素材网站分享

#25class的类继承

小程序设置按钮分享功能
![[recommendation system learning] recommendation system architecture](/img/a8/448f6e708227555bb6b32cdc652435.png)
[recommendation system learning] recommendation system architecture

MySQL index

Romance of the Three Kingdoms: responsibility chain model

vue--vuerouter缓存路由组件

类型多样的石膏PBR多通道贴图素材,速来收藏!
随机推荐
vue--vuerouter缓存路由组件
MySQL index
Programmer interview guide - self introduction
【动态规划】剑指 Offer II 091. 粉刷房子
Hello, is it safe to open an online stock account and buy stocks now?
Record the use process of fenics
Knapsack problem with dependency
[buuctf.reverse] 126-130
Wechat app mall, review products, upload commodity pictures, and score Commodity Services
14 MySQL tutorial insert insert data
Viewing the task arrangement ability of monorepo tool from turborepo
Detailed explanation of browser storage methods: the origin and difference of cookies, localstorage and sessionstorage
【QNX】命令
Redis and database data consistency
9、智慧交通项目(2)
When I was in the library, I thought of the yuan sharing mode
Treasure and niche CTA animation material website sharing
Platform management background and merchant menu resource management: access control design of platform management background
物联网协议的王者:MQTT
有依赖的背包问题