腾讯云
开发者社区
文档
建议反馈
控制台
登录/注册
首页
学习
活动
专区
圈层
工具
MCP广场
文章/答案/技术大牛
搜索
搜索
关闭
发布
文章
问答
(764)
视频
沙龙
1
回答
TypeError
:
img
应为
PIL
Image
。已
获取
<
class
‘
torch.T
’>
、
、
import torch ) return self.conv(x) raise
TypeError
('
img
should be
PIL
Image
浏览 81
提问于2021-02-22
得票数 0
2
回答
img
应为
PIL
Image
。已
获取
<
class
‘
torch.T
’>
、
我试图迭代一个加载器来检查它是否工作,但是给出了下面的错误:我尝试同时添加transforms.ToTensor()和transforms.ToPILImage(),但它给出了一个要求相反的错误。
浏览 4
提问于2019-07-17
得票数 9
回答已采纳
1
回答
TypeError
:
img
应为
PIL
Image
。
获取
<
class
'numpy.ndarray'> - PyTorch
、
、
、
/torchvision/transforms/functional_
pil
.py in resize(
img
, size, interpolation) 208 if not _is_
pil
_
image
(
img
): --> 209 raise
TypeError
(&
浏览 22
提问于2021-04-23
得票数 0
回答已采纳
1
回答
修复错误
img
应为
PIL
图像。已
获取
<
class
‘
torch.T
’>
下面是我的数据集类和转换: transforms = transforms.Compose([transforms.Resize(224,224)]) self.label = label
img
= io.imread(self.path[index])
浏览 0
提问于2020-10-12
得票数 1
回答已采纳
1
回答
TypeError
: pic
应为
PIL
Image
或ndarray。
获取
<
class
‘bool’>
、
、
运行代码时,我收到以下错误消息:
TypeError
: pic
应为
PIL
Image
或ndarray。
获取
import os import torchfrom torch.utils.data import Datasettransforms, utilsimport pandas as
浏览 110
提问于2020-07-16
得票数 0
回答已采纳
1
回答
python:
TypeError
: pic中的数据扩充错误
应为
PIL
Image
或ndarray。已
获取
<
class
‘
torch.T
’>
、
、
、
、
路径'/content/data/
img
‘包含'.jpg’格式的图像。请看一下代码: 谢谢。
浏览 12
提问于2021-05-28
得票数 0
回答已采纳
5
回答
如何修复"AttributeError:'JpegImageFile‘对象没有'read’属性?
、
、
我已经尝试过这些代码:
img
= process_
image
(
Image
.open(
image
)) #Predict the
class
(or classes) of an
image
using
img</e
浏览 298
提问于2019-07-04
得票数 12
3
回答
从图像
PIL
中
获取
图像文件名
、
、
是否可以从
Image
对象中
获取
已
打开的
Image
的文件名?我检查了API,我能找到的最好的是
PIL
.
Image
.info,但当我检查它时,它似乎是空的。还有没有其他东西可以用来在
PIL
Image
库中
获取
此信息?from
PIL
import
Image
def foo_
img
(
img</
浏览 0
提问于2017-07-14
得票数 13
回答已采纳
1
回答
如何解析在线图片python的像素数据
、
、
编辑:据我所知,我没有包括代码(scikit-
image
,pillow,imagemagick)是一个完全的死胡同。不是找人为我写代码,只是在正确的方向上的指针。
浏览 11
提问于2019-01-17
得票数 0
1
回答
如何修正“
TypeError
:
img
应该是
PIL
图像。得到<
class
‘str’>”?
、
、
、
我通常会得到如下相同的错误消息: # Imports here import numpy/transforms/transforms.py in __call__(self,
img
) 174, size, interpolation
浏览 1
提问于2019-07-03
得票数 0
回答已采纳
1
回答
PIL
.
Image
to cv2:参数'src‘
应为
Ptr<cv::UMat>
、
、
、
我使用pyautogui库来截取屏幕截图,并将其存储为
PIL
.
Image
.
Image
。当我尝试使用cv2的cvtColor()函数来转换它时,我得到了一个
TypeError
:下面是我的代码:print(type(
img
)) #<<em
浏览 24
提问于2020-05-31
得票数 2
回答已采纳
1
回答
图像转换为np数组,执行操作并返回到图像
、
、
、
、
resize(
img
_array, (
IMG
_SIZE,
IMG
_SIZE)) y_test
img
_orig = X_test[:]
img
_orig.astype(int)
img
_orig =
PIL
.
Image
.fromarray(n
浏览 2
提问于2018-08-24
得票数 0
1
回答
可以在pytorch的transform.compose中添加自己的函数吗
、
、
、
、
transforms.ToTensor(),]) 哪里, def ycbcr(
img
):
img
= cv2.cvtColor(
img
, cv2.COLOR_BGR2ycbcr) return t training_dataset = datasets.
浏览 127
提问于2020-10-19
得票数 0
1
回答
将图像转换为黑色上的白色并进行预测
、
、
/torchvision/transforms/transforms.py in __call__(self,
img
) 236 """--> 238 raise
TypeError
浏览 9
提问于2019-10-22
得票数 0
回答已采纳
1
回答
TypeError
:
img
应为
PIL
Image
。即使使用的是最新的pytorch版本,也获得了<
class
‘torch.张量’>
、
、
WHen我尝试运行相同的代码,我得到了错误:
TypeError
:
img
应为
PIL
Image
。已
获取
例如,当尝试将任何转换应用于我的张量时,下面的代码给我一个错误: def randRoll(batch, deg): rotator = torchvision.transforms.RandomRotation
浏览 22
提问于2021-04-30
得票数 1
3
回答
如何从numpy float32数组创建镜像?
、
、
图像的尺寸
应为
226×226。我试图使用
PIL
.
Image
来创建图像,但是我得到了一个错误。我读到
PIL
.
Image
.fromarray需要一个对象和模式,而对于float,我需要像我尝试的那样用'F'调用fromarray。这就是我想要做的:
img
=
Image
.fromarray(slice56, mode='F') #type(slice56
浏览 0
提问于2016-08-10
得票数 7
回答已采纳
1
回答
将PDF作为图片阅读
、
、
、
所以我首先尝试把pdf转换成jpeg:
img
= convert_from_path('mypdf.pdf')import matplotlib.pyplot as plt
TypeError
: Object
img
是一个
PIL
对象,
浏览 0
提问于2019-08-26
得票数 2
回答已采纳
7
回答
如何使用
PIL
获取
图片大小?
、
、
如何使用
PIL
或任何其他Python库
获取
图片的大小?
浏览 3
提问于2011-06-23
得票数 357
回答已采纳
3
回答
如何将图像本身而不是其路径传递到用于解码pdf417的zxing库
、
、
、
、
代码: import zxingpath = 'C:/Users/UI UX/Desktop/Uasa.png'print(barcode) 当我使用上面的代码时,工作正常并返回结果:import zxing reader = zxing.Ba
浏览 28
提问于2021-01-19
得票数 0
回答已采纳
2
回答
PIL
和python静态类型
、
、
我有一个函数参数,它可以接受图像的几种类型: def somefunc(
img
: Union[np.array,
Image
, Path, str]): 这种情况下的
PIL
Image
会抛出以下异常:
TypeError
: Union[arg, ...]: each arg must be a type.Got <module '
PIL
.
Image
' from ...这在进一步检查图像对象之后是有意义的: print(type(
Image
浏览 65
提问于2019-10-04
得票数 10
回答已采纳
点击加载更多
热门
标签
更多标签
云服务器
ICP备案
对象存储
云点播
智聆口语评测
活动推荐
运营活动
广告
关闭
领券