2021
03-05
03-05
Pytorch模型迁移和迁移学习,导入部分模型参数的操作
1.利用resnet18做迁移学习importtorchfromtorchvisionimportmodelsif__name__=="__main__":#device=torch.device("cuda"iftorch.cuda.is_available()else"cpu")device='cpu'print("-----device:{}".format(device))print("-----Pytorchversion:{}".format(torch.__version__))input_tensor=torch.zeros(1,3,100,100)print('input_tensor:',input_tensor.shape)pretrained_file="model/r...
继续阅读 >