update
Browse files
app.py
CHANGED
|
@@ -9,11 +9,11 @@ import torchvision.transforms.functional as TF
|
|
| 9 |
channels = [64, 128, 256, 512]
|
| 10 |
layers = [2, 2, 4, 2]
|
| 11 |
num_subnet = 4
|
| 12 |
-
net_i = FullNet_NLP(channels, layers, num_subnet, 4,num_classes=1000, drop_path=0,save_memory=True, inter_supv=True, head_init_scale=None,kernel_size=3).
|
| 13 |
for param in net_i.parameters():
|
| 14 |
param.data = param.data.to(torch.float16)
|
| 15 |
net_i.load_state_dict(torch.load('./fp16_check.pt')['icnn'])
|
| 16 |
-
net_c = PretrainedConvNext("convnext_small_in22k").
|
| 17 |
net_c.load_state_dict(torch.load('./classifier_32.pt')['icnn'])
|
| 18 |
net_i.eval()
|
| 19 |
net_c.eval()
|
|
@@ -25,8 +25,8 @@ def align(x1):
|
|
| 25 |
def predict(img):
|
| 26 |
with torch.no_grad():
|
| 27 |
img=align(img)
|
| 28 |
-
image_tensor=TF.to_tensor(img).
|
| 29 |
-
image_tensor=image_tensor.unsqueeze(0).
|
| 30 |
ipt=net_c(image_tensor)
|
| 31 |
image_tensor = image_tensor.half()
|
| 32 |
ipt = ipt.half()
|
|
|
|
| 9 |
channels = [64, 128, 256, 512]
|
| 10 |
layers = [2, 2, 4, 2]
|
| 11 |
num_subnet = 4
|
| 12 |
+
net_i = FullNet_NLP(channels, layers, num_subnet, 4,num_classes=1000, drop_path=0,save_memory=True, inter_supv=True, head_init_scale=None,kernel_size=3).cuda()
|
| 13 |
for param in net_i.parameters():
|
| 14 |
param.data = param.data.to(torch.float16)
|
| 15 |
net_i.load_state_dict(torch.load('./fp16_check.pt')['icnn'])
|
| 16 |
+
net_c = PretrainedConvNext("convnext_small_in22k").cuda()
|
| 17 |
net_c.load_state_dict(torch.load('./classifier_32.pt')['icnn'])
|
| 18 |
net_i.eval()
|
| 19 |
net_c.eval()
|
|
|
|
| 25 |
def predict(img):
|
| 26 |
with torch.no_grad():
|
| 27 |
img=align(img)
|
| 28 |
+
image_tensor=TF.to_tensor(img).cuda()
|
| 29 |
+
image_tensor=image_tensor.unsqueeze(0).cuda()
|
| 30 |
ipt=net_c(image_tensor)
|
| 31 |
image_tensor = image_tensor.half()
|
| 32 |
ipt = ipt.half()
|