Upload 2 files
Browse files- 7704_inference.py +11 -3
- tags.json +0 -0
7704_inference.py
CHANGED
@@ -9,9 +9,17 @@ model = torch.load('model.pth').to("cuda")
|
|
9 |
model.eval()
|
10 |
config = resolve_data_config({}, model=model)
|
11 |
transform = transforms.Compose([
|
12 |
-
transforms.Resize((
|
13 |
transforms.ToTensor(),
|
14 |
-
transforms.Normalize(mean=[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
])
|
16 |
|
17 |
with open("tags.json", "r") as file:
|
@@ -35,4 +43,4 @@ for i in range(top10_prob.size(0)):
|
|
35 |
print(allowed_tags[top10_catid[i]], top10_prob[i].item())
|
36 |
end = time.time()
|
37 |
print(f'Executed in {end - start} seconds')
|
38 |
-
print("\n\n", end="")
|
|
|
9 |
model.eval()
|
10 |
config = resolve_data_config({}, model=model)
|
11 |
transform = transforms.Compose([
|
12 |
+
transforms.Resize((224, 224)),
|
13 |
transforms.ToTensor(),
|
14 |
+
transforms.Normalize(mean=[
|
15 |
+
0.48145466,
|
16 |
+
0.4578275,
|
17 |
+
0.40821073
|
18 |
+
], std=[
|
19 |
+
0.26862954,
|
20 |
+
0.26130258,
|
21 |
+
0.27577711
|
22 |
+
]) # Normalize image
|
23 |
])
|
24 |
|
25 |
with open("tags.json", "r") as file:
|
|
|
43 |
print(allowed_tags[top10_catid[i]], top10_prob[i].item())
|
44 |
end = time.time()
|
45 |
print(f'Executed in {end - start} seconds')
|
46 |
+
print("\n\n", end="")
|
tags.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|