WuJie1010 / Facial-Expression-Recognition.Pytorch

A CNN based pytorch implementation on facial expression recognition (FER2013 and CK+), achieving 73.112% (state-of-the-art) in FER2013 and 94.64% in CK+ dataset
MIT License
1.78k stars 548 forks source link

Save Model Problem #62

Closed DanielXu123 closed 4 years ago

DanielXu123 commented 4 years ago

Hi, Wujie.

你好

我想问一下, 网络的输入这里都是需要被resize成 44441 的灰度图像吗?

因为我这边需要尝试将训练的模型保存成onnx格式,但是一直报错好像onnx存储的格式有问题,所以想和你确认下网络的输入

谢谢

DanielXu123 commented 4 years ago

BTW, mainpro_FER.py 文件中的best_PrivateTest_acc_epoch 定义了两个, 第一个应该是手误写错了

WuJie1010 commented 4 years ago

是的,网络的输入都resize成44*44~

DanielXu123 commented 4 years ago

是的,网络的输入都resize成44*44~

可否再指教一下, 在visualize.py 这个文件中先做resize 48,48 这一步是否是必须做的??

因为现在我训练出来的pth和通过pth转换出来的onnx模型参数对不上, debug发现是因为这一步resize 48*48 导致的. 这一步的目的主要是为了什么呢? gray = resize(gray, (48,48), mode='symmetric').astype(np.uint8) 既然已经有了 transform_test = transforms.Compose([ transforms.TenCrop(44), transforms.Lambda(lambda crops: torch.stack([transforms.ToTensor()(crop) for crop in crops])), ])

WuJie1010 commented 4 years ago

是的,网络的输入都resize成44*44~

可否再指教一下, 在visualize.py 这个文件中先做resize 48,48 这一步是否是必须做的??

因为现在我训练出来的pth和通过pth转换出来的onnx模型参数对不上, debug发现是因为这一步resize 48*48 导致的. 这一步的目的主要是为了什么呢? gray = resize(gray, (48,48), mode='symmetric').astype(np.uint8) 既然已经有了 transform_test = transforms.Compose([ transforms.TenCrop(44), transforms.Lambda(lambda crops: torch.stack([transforms.ToTensor()(crop) for crop in crops])), ])

您可以尝试下效果~