RuntimeError: Input type (torch.cuda.ByteTensor) and weight type (torch.cuda.FloatTensor) should be

目录

全部报错:

环境:

前言:

错误原因:


全部报错:

RuntimeError: Input type (torch.cuda.ByteTensor) and weight type (torch.cuda.FloatTensor) should be the same。

环境:

torch 1.7.0+cu102

torchvision 0.8.1+cu102

mmcv-full (torch1.7.0+cuda10.2)

系统:Centos 7

前言:

在使用 mmclassification 完成分类任务的时候报了这个错误!

首先,因为 mmclassification 是商汤科技封装好了的算法,,所以不用怀疑是算法内部出了问题。

在这之前,,我修改了配置文件里面的数据增强

错误原因:

数据增强的使用出现了错误:

1.将标准化删除了Normalize(可能性很大)

2.位置不对(数据增强按照从上到下的顺序对数据进行操作,可能是因为顺序错了)(可能性有,但不大)

注:此处我是因为将标准化删除了导致的报错。之前在做实验的时候发现不使用标准化训练得到的测试结果更好。

官方给出的例子:

教程 4:如何设计数据处理流程 — MMClassification 0.23.2 文档

所有的数据增强详见此处:(mmcls/datasets/pipelines/__init__.py)

      QQ:1757092754  欢迎一起学习、交流! 

猜你喜欢

转载自blog.csdn.net/m0_61139217/article/details/126432425