(img_in)
| 111 | # unnormalize image |
| 112 | __imagenet_stats = {'mean': [0.485, 0.456, 0.406], 'std': [0.229, 0.224, 0.225]} |
| 113 | def unnormalize(img_in): |
| 114 | img_out = np.zeros(img_in.shape) |
| 115 | for ich in range(3): |
| 116 | img_out[:, :, ich] = img_in[:, :, ich] * __imagenet_stats['std'][ich] |
| 117 | img_out[:, :, ich] += __imagenet_stats['mean'][ich] |
| 118 | img_out = (img_out * 255).astype(np.uint8) |
| 119 | return img_out |
| 120 | |
| 121 | |
| 122 | # kappa to exp error (only applicable to AngMF distribution) |