主页链接:https://hbzju.github.io/pico/
代码链接:https://github.com/hbzju/pico
1. 环境配置
按照作者的环境配置即可。我的设备比较老,所以是按照这个配置的:
较老环境配置版本记录:
https://blog.csdn.net/m0_59741202/article/details/130308874
特别注意torch,torchvision和pillow
实操发现1080ti单卡也没问题。
2. 弹出很多有关tensorflow的信息
不知道为什么。作者提供的requirements里面没有提到tensorflow。但是我报了这个错误。所以按照上面提到的环境配置(较老环境配置版本记录)换了同时拥有tensorflow1.x和torch1.2.0的环境。(当然作者的环境配置更高)
3. train时打印NameSpace信息后直接结束
检查一下输出信息有没有:
gpu=None
这应该是没有找到GPU。我的设备比较老,是因为torch和torchvision,CUDA不对应。参见上面提到的文章。配置GPU环境。
配置完后检查:
import torch
print(torch.cuda.is_available())
如果为True说明没问题
(这个配置的过程极有可能改变numpy的版本,造成错误4)
4. numpy版本
FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_qint8 = np.dtype([("qint8", np.int8, 1)])
Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
出现以上信息说明numpy版本有问题。建议安装对应版本。
我的numpy==1.16.0
5.Label问题
RuntimeError: Expected object of scalar type Long but got scalar type Float for sequence element 2 in sequence argument at position #1 'tensors'
把代码中的部分修改为:
pseudo_labels = torch.cat((pseudo_labels_b.long(), pseudo_labels_b.long(), self.queue_pseudo.clone().detach().long()), dim=0)
6.Userwarning
train.py:113: UserWarning: You have chosen to seed training. This will turn on the CUDNN deterministic setting, which can slow down your training considerably! You may see unexpected behavior when restarting from checkpoints.
warnings.warn('You have chosen to seed training. '
其实应该不影响训练,加入
import warnings
warnings.filterwarnings("ignore")
可以让信息不输出。