-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest1.py
35 lines (26 loc) · 862 Bytes
/
test1.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import torch
import torchvision.transforms as transforms
from bdjscc import BDJSCC as model
from train import store_test_image
from PIL import Image
# Load the model
model = model().cuda()
if False:
# Load the image
image = Image.open('/data/Users/lanli/ReActNet-master/dataset/imagenet/val/n01440764/ILSVRC2012_val_00000293.JPEG')
transforms = transforms.Compose([
transforms.Resize((256, 256)),
transforms.ToTensor()
])
image = transforms(image).unsqueeze(0).cuda()
# Load checkpoint
checkpoint = torch.load('checkpoints/checkpoint_ada_thick_rprelu_6+_2.tar')
model.load_state_dict(checkpoint['model'])
# Forward pass
output = model(image)
else:
a = torch.zeros(1, 3, 256, 256).cuda()
output = model(a)
print(output.shape)
# Store the test image
# store_test_image(image, output, -1, 0)