报错:
File "/home/xinying/CDCN-Face-Anti-Spoofing.pytorch/trainer/FASTrainer.py", line 153, in train
depth_map_15, depth_map_8, depth_map_5 = depth_map_15.to(self.device), depth_map_8.to(self.device), depth_map_5.to(self.device)
AttributeError: 'numpy.ndarray' object has no attribute 'to'
depth_maps = torch.tensor(np.array(depth_maps).astype(float))
ValueError: only one element tensors can be converted to Python scalars
要将数组或列表转成tensor类型
数组转tensor,直接:
images = torch.tensor(images)
depth_maps = torch.tensor(depth_maps)
#depth_maps = torch.tensor(np.array(depth_maps).astype(float))
depth_map_15 = torch.tensor(depth_map_15)
depth_map_8 = torch.tensor(depth_map_8)
depth_map_5 = torch.tensor(depth_map_5)