Spaces:
Runtime error
Runtime error
Merge branch 'main' of https://huggingface.co/spaces/reidddd/carDamageDetection
Browse files- .gitignore +5 -1
- a.png +0 -0
- ad.png +0 -0
- app.py +138 -2
- download.jpeg +0 -0
- imagenet_classes.txt +1000 -0
- model.py +164 -0
- requirements.txt +4 -0
- temp.py +6 -6
- test.py +21 -0
.gitignore
CHANGED
@@ -1,3 +1,7 @@
|
|
1 |
**/model_final.pth
|
2 |
**/__pycache__
|
3 |
-
|
|
|
|
|
|
|
|
|
|
1 |
**/model_final.pth
|
2 |
**/__pycache__
|
3 |
+
**/*.png
|
4 |
+
**/*.jpeg
|
5 |
+
**/*.jpg
|
6 |
+
**/model_final.ptht7kgwblo.part
|
7 |
+
**/model_final.ptht7kgwblo
|
a.png
ADDED
![]() |
ad.png
ADDED
![]() |
app.py
CHANGED
@@ -7,16 +7,72 @@ from roboflow import Roboflow
|
|
7 |
import supervision as sv
|
8 |
import cv2
|
9 |
import tempfile
|
|
|
10 |
import os
|
11 |
import requests
|
12 |
import requests
|
13 |
import cloudinary
|
|
|
14 |
import cloudinary.uploader
|
15 |
from a import main
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
# Initialize Flask app
|
18 |
app = Flask(__name__)
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
@app.route("/")
|
22 |
def home():
|
@@ -26,6 +82,7 @@ def home():
|
|
26 |
@app.route("/fetch-image", methods=["POST"])
|
27 |
def fetchImage():
|
28 |
file = None
|
|
|
29 |
if "url" in request.form:
|
30 |
url = request.form["url"]
|
31 |
response = requests.get(url)
|
@@ -143,7 +200,7 @@ def fetchImage():
|
|
143 |
part_name, 0
|
144 |
) # Default to 0 if part not in dict
|
145 |
repair_cost = (damage_percentage / 100) * 10 * base_cost
|
146 |
-
total_cost += repair_cost
|
147 |
|
148 |
print(
|
149 |
f"Damage {i + 1} - {part_name}: {damage_percentage:.2f}% damaged, Cost: ${repair_cost:.2f}"
|
@@ -186,5 +243,84 @@ def generate_report():
|
|
186 |
return jsonify({"message": "Something happened!."}), 404
|
187 |
|
188 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
if __name__ == "__main__":
|
190 |
app.run(host="0.0.0.0", port=7860)
|
|
|
7 |
import supervision as sv
|
8 |
import cv2
|
9 |
import tempfile
|
10 |
+
import gdown
|
11 |
import os
|
12 |
import requests
|
13 |
import requests
|
14 |
import cloudinary
|
15 |
+
import model
|
16 |
import cloudinary.uploader
|
17 |
from a import main
|
18 |
+
import numpy as np
|
19 |
+
import torchvision.transforms as transforms
|
20 |
+
import pandas as pd
|
21 |
+
import nibabel as nib
|
22 |
+
import numpy as np
|
23 |
+
import torch
|
24 |
+
import torch.nn as nn
|
25 |
+
import torchvision
|
26 |
+
import torchvision.transforms as transforms
|
27 |
+
import cv2
|
28 |
+
from PIL import Image
|
29 |
+
from sklearn.model_selection import train_test_split
|
30 |
+
import os
|
31 |
+
import torch
|
32 |
+
import torch.nn as nn
|
33 |
+
import torch.optim as optim
|
34 |
+
import torchvision.transforms as transforms
|
35 |
+
import torchvision.models as models
|
36 |
+
from torch.utils.data import Dataset, DataLoader
|
37 |
+
import pandas as pd
|
38 |
+
from PIL import Image
|
39 |
+
import os
|
40 |
+
from sklearn.model_selection import train_test_split
|
41 |
+
from sklearn.preprocessing import MinMaxScaler
|
42 |
# Initialize Flask app
|
43 |
app = Flask(__name__)
|
44 |
|
45 |
+
GDRIVE_MODEL_URL = "https://drive.google.com/uc?id=1fzKneepaRt_--dzamTcDBM-9d3_dLX7z"
|
46 |
+
LOCAL_MODEL_PATH = "checkpoint32.pth"
|
47 |
+
d = "https://drive.google.com/uc?id=1GfrlFNoa7E4liMHyMuF73nA21yT9SNSb"
|
48 |
+
|
49 |
+
|
50 |
+
def download_file_from_google_drive():
|
51 |
+
gdown.download(GDRIVE_MODEL_URL, LOCAL_MODEL_PATH, quiet=False)
|
52 |
+
|
53 |
+
|
54 |
+
da = "a.pth"
|
55 |
+
|
56 |
+
|
57 |
+
def download_file_from_google_drived():
|
58 |
+
gdown.download(d, da, quiet=False)
|
59 |
+
|
60 |
+
|
61 |
+
def download_model():
|
62 |
+
if not os.path.exists(LOCAL_MODEL_PATH):
|
63 |
+
response = requests.get(GDRIVE_MODEL_URL, stream=True)
|
64 |
+
if response.status_code == 200:
|
65 |
+
with open(LOCAL_MODEL_PATH, "wb") as f:
|
66 |
+
f.write(response.content)
|
67 |
+
else:
|
68 |
+
raise Exception(
|
69 |
+
f"Failed to download model from Google Drive: {response.status_code}"
|
70 |
+
)
|
71 |
+
|
72 |
+
|
73 |
+
download_file_from_google_drive()
|
74 |
+
download_file_from_google_drived()
|
75 |
+
|
76 |
|
77 |
@app.route("/")
|
78 |
def home():
|
|
|
82 |
@app.route("/fetch-image", methods=["POST"])
|
83 |
def fetchImage():
|
84 |
file = None
|
85 |
+
url = ""
|
86 |
if "url" in request.form:
|
87 |
url = request.form["url"]
|
88 |
response = requests.get(url)
|
|
|
200 |
part_name, 0
|
201 |
) # Default to 0 if part not in dict
|
202 |
repair_cost = (damage_percentage / 100) * 10 * base_cost
|
203 |
+
total_cost += round(repair_cost, ndigits=1)
|
204 |
|
205 |
print(
|
206 |
f"Damage {i + 1} - {part_name}: {damage_percentage:.2f}% damaged, Cost: ${repair_cost:.2f}"
|
|
|
243 |
return jsonify({"message": "Something happened!."}), 404
|
244 |
|
245 |
|
246 |
+
@app.route("/ms-detection", methods=["POST"])
|
247 |
+
def predict():
|
248 |
+
file = request.files["file"]
|
249 |
+
|
250 |
+
if not file:
|
251 |
+
return jsonify({"error": "file not uploaded"}), 400
|
252 |
+
|
253 |
+
# Save file temporarily
|
254 |
+
temp_path = os.path.join(tempfile.gettempdir(), file.filename)
|
255 |
+
file.save(temp_path)
|
256 |
+
transform = transforms.Compose([
|
257 |
+
transforms.Resize((224, 224)),
|
258 |
+
transforms.ToTensor(),
|
259 |
+
])
|
260 |
+
if file.filename.lower().endswith((".png", ".jpg", ".jpeg")):
|
261 |
+
image = Image.open(temp_path)
|
262 |
+
image_save_path = os.path.join(
|
263 |
+
tempfile.gettempdir(), file.filename.lower())
|
264 |
+
image.save(image_save_path)
|
265 |
+
|
266 |
+
def is_mri_image(image_path):
|
267 |
+
img = cv2.imread(image_path, cv2.IMREAD_GRAYSCALE)
|
268 |
+
|
269 |
+
if img is None:
|
270 |
+
return False # Invalid image
|
271 |
+
|
272 |
+
# Apply Canny edge detection
|
273 |
+
edges = cv2.Canny(img, 50, 150)
|
274 |
+
|
275 |
+
# Calculate edge density (MRI images have high edge presence)
|
276 |
+
edge_density = np.sum(edges > 0) / edges.size
|
277 |
+
print(edge_density)
|
278 |
+
return edge_density > 0.05
|
279 |
+
|
280 |
+
if (is_mri_image(temp_path)):
|
281 |
+
return jsonify({"message": "Not an mri image", "confidence": 0.95, "saved_path": image_save_path})
|
282 |
+
a, b = model.check_file(temp_path)
|
283 |
+
|
284 |
+
class ResNetRegression(nn.Module):
|
285 |
+
def __init__(self):
|
286 |
+
super(ResNetRegression, self).__init__()
|
287 |
+
self.model = models.resnet34(pretrained=True)
|
288 |
+
in_features = self.model.fc.in_features
|
289 |
+
# Change output layer for regression
|
290 |
+
self.model.fc = nn.Linear(in_features, 1)
|
291 |
+
|
292 |
+
def forward(self, x):
|
293 |
+
return self.model(x)
|
294 |
+
|
295 |
+
# Initialize Model, Loss, and Optimizer
|
296 |
+
model_new = ResNetRegression()
|
297 |
+
checkpoint = torch.load(
|
298 |
+
"/home/user/app/a.pth", weights_only=False, map_location=torch.device('cpu'))
|
299 |
+
|
300 |
+
def remove_module_from_checkpoint(checkpoint):
|
301 |
+
new_state_dict = {}
|
302 |
+
print(checkpoint.keys())
|
303 |
+
for key, value in checkpoint.items():
|
304 |
+
new_key = key.replace("module.", "")
|
305 |
+
new_state_dict[new_key] = value
|
306 |
+
checkpoint = new_state_dict
|
307 |
+
return checkpoint
|
308 |
+
checkpoint = remove_module_from_checkpoint(checkpoint)
|
309 |
+
model_new.load_state_dict(checkpoint)
|
310 |
+
image = Image.open(temp_path).convert("RGB")
|
311 |
+
output = model_new(transform(image).unsqueeze(0))
|
312 |
+
stage = output.item()
|
313 |
+
if not a == "No ms detected":
|
314 |
+
if stage <= 2.0:
|
315 |
+
stage = "Mild"
|
316 |
+
elif stage >= 2.0 and stage <= 3.2:
|
317 |
+
stage = "Moderate"
|
318 |
+
else:
|
319 |
+
stage = "Severe"
|
320 |
+
else:
|
321 |
+
stage = "No ms detected"
|
322 |
+
return jsonify({"message": a, "confidence": b, "stage": stage, "saved_path": image_save_path})
|
323 |
+
|
324 |
+
|
325 |
if __name__ == "__main__":
|
326 |
app.run(host="0.0.0.0", port=7860)
|
download.jpeg
ADDED
![]() |
imagenet_classes.txt
ADDED
@@ -0,0 +1,1000 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
tench
|
2 |
+
goldfish
|
3 |
+
great white shark
|
4 |
+
tiger shark
|
5 |
+
hammerhead
|
6 |
+
electric ray
|
7 |
+
stingray
|
8 |
+
cock
|
9 |
+
hen
|
10 |
+
ostrich
|
11 |
+
brambling
|
12 |
+
goldfinch
|
13 |
+
house finch
|
14 |
+
junco
|
15 |
+
indigo bunting
|
16 |
+
robin
|
17 |
+
bulbul
|
18 |
+
jay
|
19 |
+
magpie
|
20 |
+
chickadee
|
21 |
+
water ouzel
|
22 |
+
kite
|
23 |
+
bald eagle
|
24 |
+
vulture
|
25 |
+
great grey owl
|
26 |
+
European fire salamander
|
27 |
+
common newt
|
28 |
+
eft
|
29 |
+
spotted salamander
|
30 |
+
axolotl
|
31 |
+
bullfrog
|
32 |
+
tree frog
|
33 |
+
tailed frog
|
34 |
+
loggerhead
|
35 |
+
leatherback turtle
|
36 |
+
mud turtle
|
37 |
+
terrapin
|
38 |
+
box turtle
|
39 |
+
banded gecko
|
40 |
+
common iguana
|
41 |
+
American chameleon
|
42 |
+
whiptail
|
43 |
+
agama
|
44 |
+
frilled lizard
|
45 |
+
alligator lizard
|
46 |
+
Gila monster
|
47 |
+
green lizard
|
48 |
+
African chameleon
|
49 |
+
Komodo dragon
|
50 |
+
African crocodile
|
51 |
+
American alligator
|
52 |
+
triceratops
|
53 |
+
thunder snake
|
54 |
+
ringneck snake
|
55 |
+
hognose snake
|
56 |
+
green snake
|
57 |
+
king snake
|
58 |
+
garter snake
|
59 |
+
water snake
|
60 |
+
vine snake
|
61 |
+
night snake
|
62 |
+
boa constrictor
|
63 |
+
rock python
|
64 |
+
Indian cobra
|
65 |
+
green mamba
|
66 |
+
sea snake
|
67 |
+
horned viper
|
68 |
+
diamondback
|
69 |
+
sidewinder
|
70 |
+
trilobite
|
71 |
+
harvestman
|
72 |
+
scorpion
|
73 |
+
black and gold garden spider
|
74 |
+
barn spider
|
75 |
+
garden spider
|
76 |
+
black widow
|
77 |
+
tarantula
|
78 |
+
wolf spider
|
79 |
+
tick
|
80 |
+
centipede
|
81 |
+
black grouse
|
82 |
+
ptarmigan
|
83 |
+
ruffed grouse
|
84 |
+
prairie chicken
|
85 |
+
peacock
|
86 |
+
quail
|
87 |
+
partridge
|
88 |
+
African grey
|
89 |
+
macaw
|
90 |
+
sulphur-crested cockatoo
|
91 |
+
lorikeet
|
92 |
+
coucal
|
93 |
+
bee eater
|
94 |
+
hornbill
|
95 |
+
hummingbird
|
96 |
+
jacamar
|
97 |
+
toucan
|
98 |
+
drake
|
99 |
+
red-breasted merganser
|
100 |
+
goose
|
101 |
+
black swan
|
102 |
+
tusker
|
103 |
+
echidna
|
104 |
+
platypus
|
105 |
+
wallaby
|
106 |
+
koala
|
107 |
+
wombat
|
108 |
+
jellyfish
|
109 |
+
sea anemone
|
110 |
+
brain coral
|
111 |
+
flatworm
|
112 |
+
nematode
|
113 |
+
conch
|
114 |
+
snail
|
115 |
+
slug
|
116 |
+
sea slug
|
117 |
+
chiton
|
118 |
+
chambered nautilus
|
119 |
+
Dungeness crab
|
120 |
+
rock crab
|
121 |
+
fiddler crab
|
122 |
+
king crab
|
123 |
+
American lobster
|
124 |
+
spiny lobster
|
125 |
+
crayfish
|
126 |
+
hermit crab
|
127 |
+
isopod
|
128 |
+
white stork
|
129 |
+
black stork
|
130 |
+
spoonbill
|
131 |
+
flamingo
|
132 |
+
little blue heron
|
133 |
+
American egret
|
134 |
+
bittern
|
135 |
+
crane
|
136 |
+
limpkin
|
137 |
+
European gallinule
|
138 |
+
American coot
|
139 |
+
bustard
|
140 |
+
ruddy turnstone
|
141 |
+
red-backed sandpiper
|
142 |
+
redshank
|
143 |
+
dowitcher
|
144 |
+
oystercatcher
|
145 |
+
pelican
|
146 |
+
king penguin
|
147 |
+
albatross
|
148 |
+
grey whale
|
149 |
+
killer whale
|
150 |
+
dugong
|
151 |
+
sea lion
|
152 |
+
Chihuahua
|
153 |
+
Japanese spaniel
|
154 |
+
Maltese dog
|
155 |
+
Pekinese
|
156 |
+
Shih-Tzu
|
157 |
+
Blenheim spaniel
|
158 |
+
papillon
|
159 |
+
toy terrier
|
160 |
+
Rhodesian ridgeback
|
161 |
+
Afghan hound
|
162 |
+
basset
|
163 |
+
beagle
|
164 |
+
bloodhound
|
165 |
+
bluetick
|
166 |
+
black-and-tan coonhound
|
167 |
+
Walker hound
|
168 |
+
English foxhound
|
169 |
+
redbone
|
170 |
+
borzoi
|
171 |
+
Irish wolfhound
|
172 |
+
Italian greyhound
|
173 |
+
whippet
|
174 |
+
Ibizan hound
|
175 |
+
Norwegian elkhound
|
176 |
+
otterhound
|
177 |
+
Saluki
|
178 |
+
Scottish deerhound
|
179 |
+
Weimaraner
|
180 |
+
Staffordshire bullterrier
|
181 |
+
American Staffordshire terrier
|
182 |
+
Bedlington terrier
|
183 |
+
Border terrier
|
184 |
+
Kerry blue terrier
|
185 |
+
Irish terrier
|
186 |
+
Norfolk terrier
|
187 |
+
Norwich terrier
|
188 |
+
Yorkshire terrier
|
189 |
+
wire-haired fox terrier
|
190 |
+
Lakeland terrier
|
191 |
+
Sealyham terrier
|
192 |
+
Airedale
|
193 |
+
cairn
|
194 |
+
Australian terrier
|
195 |
+
Dandie Dinmont
|
196 |
+
Boston bull
|
197 |
+
miniature schnauzer
|
198 |
+
giant schnauzer
|
199 |
+
standard schnauzer
|
200 |
+
Scotch terrier
|
201 |
+
Tibetan terrier
|
202 |
+
silky terrier
|
203 |
+
soft-coated wheaten terrier
|
204 |
+
West Highland white terrier
|
205 |
+
Lhasa
|
206 |
+
flat-coated retriever
|
207 |
+
curly-coated retriever
|
208 |
+
golden retriever
|
209 |
+
Labrador retriever
|
210 |
+
Chesapeake Bay retriever
|
211 |
+
German short-haired pointer
|
212 |
+
vizsla
|
213 |
+
English setter
|
214 |
+
Irish setter
|
215 |
+
Gordon setter
|
216 |
+
Brittany spaniel
|
217 |
+
clumber
|
218 |
+
English springer
|
219 |
+
Welsh springer spaniel
|
220 |
+
cocker spaniel
|
221 |
+
Sussex spaniel
|
222 |
+
Irish water spaniel
|
223 |
+
kuvasz
|
224 |
+
schipperke
|
225 |
+
groenendael
|
226 |
+
malinois
|
227 |
+
briard
|
228 |
+
kelpie
|
229 |
+
komondor
|
230 |
+
Old English sheepdog
|
231 |
+
Shetland sheepdog
|
232 |
+
collie
|
233 |
+
Border collie
|
234 |
+
Bouvier des Flandres
|
235 |
+
Rottweiler
|
236 |
+
German shepherd
|
237 |
+
Doberman
|
238 |
+
miniature pinscher
|
239 |
+
Greater Swiss Mountain dog
|
240 |
+
Bernese mountain dog
|
241 |
+
Appenzeller
|
242 |
+
EntleBucher
|
243 |
+
boxer
|
244 |
+
bull mastiff
|
245 |
+
Tibetan mastiff
|
246 |
+
French bulldog
|
247 |
+
Great Dane
|
248 |
+
Saint Bernard
|
249 |
+
Eskimo dog
|
250 |
+
malamute
|
251 |
+
Siberian husky
|
252 |
+
dalmatian
|
253 |
+
affenpinscher
|
254 |
+
basenji
|
255 |
+
pug
|
256 |
+
Leonberg
|
257 |
+
Newfoundland
|
258 |
+
Great Pyrenees
|
259 |
+
Samoyed
|
260 |
+
Pomeranian
|
261 |
+
chow
|
262 |
+
keeshond
|
263 |
+
Brabancon griffon
|
264 |
+
Pembroke
|
265 |
+
Cardigan
|
266 |
+
toy poodle
|
267 |
+
miniature poodle
|
268 |
+
standard poodle
|
269 |
+
Mexican hairless
|
270 |
+
timber wolf
|
271 |
+
white wolf
|
272 |
+
red wolf
|
273 |
+
coyote
|
274 |
+
dingo
|
275 |
+
dhole
|
276 |
+
African hunting dog
|
277 |
+
hyena
|
278 |
+
red fox
|
279 |
+
kit fox
|
280 |
+
Arctic fox
|
281 |
+
grey fox
|
282 |
+
tabby
|
283 |
+
tiger cat
|
284 |
+
Persian cat
|
285 |
+
Siamese cat
|
286 |
+
Egyptian cat
|
287 |
+
cougar
|
288 |
+
lynx
|
289 |
+
leopard
|
290 |
+
snow leopard
|
291 |
+
jaguar
|
292 |
+
lion
|
293 |
+
tiger
|
294 |
+
cheetah
|
295 |
+
brown bear
|
296 |
+
American black bear
|
297 |
+
ice bear
|
298 |
+
sloth bear
|
299 |
+
mongoose
|
300 |
+
meerkat
|
301 |
+
tiger beetle
|
302 |
+
ladybug
|
303 |
+
ground beetle
|
304 |
+
long-horned beetle
|
305 |
+
leaf beetle
|
306 |
+
dung beetle
|
307 |
+
rhinoceros beetle
|
308 |
+
weevil
|
309 |
+
fly
|
310 |
+
bee
|
311 |
+
ant
|
312 |
+
grasshopper
|
313 |
+
cricket
|
314 |
+
walking stick
|
315 |
+
cockroach
|
316 |
+
mantis
|
317 |
+
cicada
|
318 |
+
leafhopper
|
319 |
+
lacewing
|
320 |
+
dragonfly
|
321 |
+
damselfly
|
322 |
+
admiral
|
323 |
+
ringlet
|
324 |
+
monarch
|
325 |
+
cabbage butterfly
|
326 |
+
sulphur butterfly
|
327 |
+
lycaenid
|
328 |
+
starfish
|
329 |
+
sea urchin
|
330 |
+
sea cucumber
|
331 |
+
wood rabbit
|
332 |
+
hare
|
333 |
+
Angora
|
334 |
+
hamster
|
335 |
+
porcupine
|
336 |
+
fox squirrel
|
337 |
+
marmot
|
338 |
+
beaver
|
339 |
+
guinea pig
|
340 |
+
sorrel
|
341 |
+
zebra
|
342 |
+
hog
|
343 |
+
wild boar
|
344 |
+
warthog
|
345 |
+
hippopotamus
|
346 |
+
ox
|
347 |
+
water buffalo
|
348 |
+
bison
|
349 |
+
ram
|
350 |
+
bighorn
|
351 |
+
ibex
|
352 |
+
hartebeest
|
353 |
+
impala
|
354 |
+
gazelle
|
355 |
+
Arabian camel
|
356 |
+
llama
|
357 |
+
weasel
|
358 |
+
mink
|
359 |
+
polecat
|
360 |
+
black-footed ferret
|
361 |
+
otter
|
362 |
+
skunk
|
363 |
+
badger
|
364 |
+
armadillo
|
365 |
+
three-toed sloth
|
366 |
+
orangutan
|
367 |
+
gorilla
|
368 |
+
chimpanzee
|
369 |
+
gibbon
|
370 |
+
siamang
|
371 |
+
guenon
|
372 |
+
patas
|
373 |
+
baboon
|
374 |
+
macaque
|
375 |
+
langur
|
376 |
+
colobus
|
377 |
+
proboscis monkey
|
378 |
+
marmoset
|
379 |
+
capuchin
|
380 |
+
howler monkey
|
381 |
+
titi
|
382 |
+
spider monkey
|
383 |
+
squirrel monkey
|
384 |
+
Madagascar cat
|
385 |
+
indri
|
386 |
+
Indian elephant
|
387 |
+
African elephant
|
388 |
+
lesser panda
|
389 |
+
giant panda
|
390 |
+
barracouta
|
391 |
+
eel
|
392 |
+
coho
|
393 |
+
rock beauty
|
394 |
+
anemone fish
|
395 |
+
sturgeon
|
396 |
+
gar
|
397 |
+
lionfish
|
398 |
+
puffer
|
399 |
+
abacus
|
400 |
+
abaya
|
401 |
+
academic gown
|
402 |
+
accordion
|
403 |
+
acoustic guitar
|
404 |
+
aircraft carrier
|
405 |
+
airliner
|
406 |
+
airship
|
407 |
+
altar
|
408 |
+
ambulance
|
409 |
+
amphibian
|
410 |
+
analog clock
|
411 |
+
apiary
|
412 |
+
apron
|
413 |
+
ashcan
|
414 |
+
assault rifle
|
415 |
+
backpack
|
416 |
+
bakery
|
417 |
+
balance beam
|
418 |
+
balloon
|
419 |
+
ballpoint
|
420 |
+
Band Aid
|
421 |
+
banjo
|
422 |
+
bannister
|
423 |
+
barbell
|
424 |
+
barber chair
|
425 |
+
barbershop
|
426 |
+
barn
|
427 |
+
barometer
|
428 |
+
barrel
|
429 |
+
barrow
|
430 |
+
baseball
|
431 |
+
basketball
|
432 |
+
bassinet
|
433 |
+
bassoon
|
434 |
+
bathing cap
|
435 |
+
bath towel
|
436 |
+
bathtub
|
437 |
+
beach wagon
|
438 |
+
beacon
|
439 |
+
beaker
|
440 |
+
bearskin
|
441 |
+
beer bottle
|
442 |
+
beer glass
|
443 |
+
bell cote
|
444 |
+
bib
|
445 |
+
bicycle-built-for-two
|
446 |
+
bikini
|
447 |
+
binder
|
448 |
+
binoculars
|
449 |
+
birdhouse
|
450 |
+
boathouse
|
451 |
+
bobsled
|
452 |
+
bolo tie
|
453 |
+
bonnet
|
454 |
+
bookcase
|
455 |
+
bookshop
|
456 |
+
bottlecap
|
457 |
+
bow
|
458 |
+
bow tie
|
459 |
+
brass
|
460 |
+
brassiere
|
461 |
+
breakwater
|
462 |
+
breastplate
|
463 |
+
broom
|
464 |
+
bucket
|
465 |
+
buckle
|
466 |
+
bulletproof vest
|
467 |
+
bullet train
|
468 |
+
butcher shop
|
469 |
+
cab
|
470 |
+
caldron
|
471 |
+
candle
|
472 |
+
cannon
|
473 |
+
canoe
|
474 |
+
can opener
|
475 |
+
cardigan
|
476 |
+
car mirror
|
477 |
+
carousel
|
478 |
+
carpenter's kit
|
479 |
+
carton
|
480 |
+
car wheel
|
481 |
+
cash machine
|
482 |
+
cassette
|
483 |
+
cassette player
|
484 |
+
castle
|
485 |
+
catamaran
|
486 |
+
CD player
|
487 |
+
cello
|
488 |
+
cellular telephone
|
489 |
+
chain
|
490 |
+
chainlink fence
|
491 |
+
chain mail
|
492 |
+
chain saw
|
493 |
+
chest
|
494 |
+
chiffonier
|
495 |
+
chime
|
496 |
+
china cabinet
|
497 |
+
Christmas stocking
|
498 |
+
church
|
499 |
+
cinema
|
500 |
+
cleaver
|
501 |
+
cliff dwelling
|
502 |
+
cloak
|
503 |
+
clog
|
504 |
+
cocktail shaker
|
505 |
+
coffee mug
|
506 |
+
coffeepot
|
507 |
+
coil
|
508 |
+
combination lock
|
509 |
+
computer keyboard
|
510 |
+
confectionery
|
511 |
+
container ship
|
512 |
+
convertible
|
513 |
+
corkscrew
|
514 |
+
cornet
|
515 |
+
cowboy boot
|
516 |
+
cowboy hat
|
517 |
+
cradle
|
518 |
+
crane
|
519 |
+
crash helmet
|
520 |
+
crate
|
521 |
+
crib
|
522 |
+
Crock Pot
|
523 |
+
croquet ball
|
524 |
+
crutch
|
525 |
+
cuirass
|
526 |
+
dam
|
527 |
+
desk
|
528 |
+
desktop computer
|
529 |
+
dial telephone
|
530 |
+
diaper
|
531 |
+
digital clock
|
532 |
+
digital watch
|
533 |
+
dining table
|
534 |
+
dishrag
|
535 |
+
dishwasher
|
536 |
+
disk brake
|
537 |
+
dock
|
538 |
+
dogsled
|
539 |
+
dome
|
540 |
+
doormat
|
541 |
+
drilling platform
|
542 |
+
drum
|
543 |
+
drumstick
|
544 |
+
dumbbell
|
545 |
+
Dutch oven
|
546 |
+
electric fan
|
547 |
+
electric guitar
|
548 |
+
electric locomotive
|
549 |
+
entertainment center
|
550 |
+
envelope
|
551 |
+
espresso maker
|
552 |
+
face powder
|
553 |
+
feather boa
|
554 |
+
file
|
555 |
+
fireboat
|
556 |
+
fire engine
|
557 |
+
fire screen
|
558 |
+
flagpole
|
559 |
+
flute
|
560 |
+
folding chair
|
561 |
+
football helmet
|
562 |
+
forklift
|
563 |
+
fountain
|
564 |
+
fountain pen
|
565 |
+
four-poster
|
566 |
+
freight car
|
567 |
+
French horn
|
568 |
+
frying pan
|
569 |
+
fur coat
|
570 |
+
garbage truck
|
571 |
+
gasmask
|
572 |
+
gas pump
|
573 |
+
goblet
|
574 |
+
go-kart
|
575 |
+
golf ball
|
576 |
+
golfcart
|
577 |
+
gondola
|
578 |
+
gong
|
579 |
+
gown
|
580 |
+
grand piano
|
581 |
+
greenhouse
|
582 |
+
grille
|
583 |
+
grocery store
|
584 |
+
guillotine
|
585 |
+
hair slide
|
586 |
+
hair spray
|
587 |
+
half track
|
588 |
+
hammer
|
589 |
+
hamper
|
590 |
+
hand blower
|
591 |
+
hand-held computer
|
592 |
+
handkerchief
|
593 |
+
hard disc
|
594 |
+
harmonica
|
595 |
+
harp
|
596 |
+
harvester
|
597 |
+
hatchet
|
598 |
+
holster
|
599 |
+
home theater
|
600 |
+
honeycomb
|
601 |
+
hook
|
602 |
+
hoopskirt
|
603 |
+
horizontal bar
|
604 |
+
horse cart
|
605 |
+
hourglass
|
606 |
+
iPod
|
607 |
+
iron
|
608 |
+
jack-o'-lantern
|
609 |
+
jean
|
610 |
+
jeep
|
611 |
+
jersey
|
612 |
+
jigsaw puzzle
|
613 |
+
jinrikisha
|
614 |
+
joystick
|
615 |
+
kimono
|
616 |
+
knee pad
|
617 |
+
knot
|
618 |
+
lab coat
|
619 |
+
ladle
|
620 |
+
lampshade
|
621 |
+
laptop
|
622 |
+
lawn mower
|
623 |
+
lens cap
|
624 |
+
letter opener
|
625 |
+
library
|
626 |
+
lifeboat
|
627 |
+
lighter
|
628 |
+
limousine
|
629 |
+
liner
|
630 |
+
lipstick
|
631 |
+
Loafer
|
632 |
+
lotion
|
633 |
+
loudspeaker
|
634 |
+
loupe
|
635 |
+
lumbermill
|
636 |
+
magnetic compass
|
637 |
+
mailbag
|
638 |
+
mailbox
|
639 |
+
maillot
|
640 |
+
maillot
|
641 |
+
manhole cover
|
642 |
+
maraca
|
643 |
+
marimba
|
644 |
+
mask
|
645 |
+
matchstick
|
646 |
+
maypole
|
647 |
+
maze
|
648 |
+
measuring cup
|
649 |
+
medicine chest
|
650 |
+
megalith
|
651 |
+
microphone
|
652 |
+
microwave
|
653 |
+
military uniform
|
654 |
+
milk can
|
655 |
+
minibus
|
656 |
+
miniskirt
|
657 |
+
minivan
|
658 |
+
missile
|
659 |
+
mitten
|
660 |
+
mixing bowl
|
661 |
+
mobile home
|
662 |
+
Model T
|
663 |
+
modem
|
664 |
+
monastery
|
665 |
+
monitor
|
666 |
+
moped
|
667 |
+
mortar
|
668 |
+
mortarboard
|
669 |
+
mosque
|
670 |
+
mosquito net
|
671 |
+
motor scooter
|
672 |
+
mountain bike
|
673 |
+
mountain tent
|
674 |
+
mouse
|
675 |
+
mousetrap
|
676 |
+
moving van
|
677 |
+
muzzle
|
678 |
+
nail
|
679 |
+
neck brace
|
680 |
+
necklace
|
681 |
+
nipple
|
682 |
+
notebook
|
683 |
+
obelisk
|
684 |
+
oboe
|
685 |
+
ocarina
|
686 |
+
odometer
|
687 |
+
oil filter
|
688 |
+
organ
|
689 |
+
oscilloscope
|
690 |
+
overskirt
|
691 |
+
oxcart
|
692 |
+
oxygen mask
|
693 |
+
packet
|
694 |
+
paddle
|
695 |
+
paddlewheel
|
696 |
+
padlock
|
697 |
+
paintbrush
|
698 |
+
pajama
|
699 |
+
palace
|
700 |
+
panpipe
|
701 |
+
paper towel
|
702 |
+
parachute
|
703 |
+
parallel bars
|
704 |
+
park bench
|
705 |
+
parking meter
|
706 |
+
passenger car
|
707 |
+
patio
|
708 |
+
pay-phone
|
709 |
+
pedestal
|
710 |
+
pencil box
|
711 |
+
pencil sharpener
|
712 |
+
perfume
|
713 |
+
Petri dish
|
714 |
+
photocopier
|
715 |
+
pick
|
716 |
+
pickelhaube
|
717 |
+
picket fence
|
718 |
+
pickup
|
719 |
+
pier
|
720 |
+
piggy bank
|
721 |
+
pill bottle
|
722 |
+
pillow
|
723 |
+
ping-pong ball
|
724 |
+
pinwheel
|
725 |
+
pirate
|
726 |
+
pitcher
|
727 |
+
plane
|
728 |
+
planetarium
|
729 |
+
plastic bag
|
730 |
+
plate rack
|
731 |
+
plow
|
732 |
+
plunger
|
733 |
+
Polaroid camera
|
734 |
+
pole
|
735 |
+
police van
|
736 |
+
poncho
|
737 |
+
pool table
|
738 |
+
pop bottle
|
739 |
+
pot
|
740 |
+
potter's wheel
|
741 |
+
power drill
|
742 |
+
prayer rug
|
743 |
+
printer
|
744 |
+
prison
|
745 |
+
projectile
|
746 |
+
projector
|
747 |
+
puck
|
748 |
+
punching bag
|
749 |
+
purse
|
750 |
+
quill
|
751 |
+
quilt
|
752 |
+
racer
|
753 |
+
racket
|
754 |
+
radiator
|
755 |
+
radio
|
756 |
+
radio telescope
|
757 |
+
rain barrel
|
758 |
+
recreational vehicle
|
759 |
+
reel
|
760 |
+
reflex camera
|
761 |
+
refrigerator
|
762 |
+
remote control
|
763 |
+
restaurant
|
764 |
+
revolver
|
765 |
+
rifle
|
766 |
+
rocking chair
|
767 |
+
rotisserie
|
768 |
+
rubber eraser
|
769 |
+
rugby ball
|
770 |
+
rule
|
771 |
+
running shoe
|
772 |
+
safe
|
773 |
+
safety pin
|
774 |
+
saltshaker
|
775 |
+
sandal
|
776 |
+
sarong
|
777 |
+
sax
|
778 |
+
scabbard
|
779 |
+
scale
|
780 |
+
school bus
|
781 |
+
schooner
|
782 |
+
scoreboard
|
783 |
+
screen
|
784 |
+
screw
|
785 |
+
screwdriver
|
786 |
+
seat belt
|
787 |
+
sewing machine
|
788 |
+
shield
|
789 |
+
shoe shop
|
790 |
+
shoji
|
791 |
+
shopping basket
|
792 |
+
shopping cart
|
793 |
+
shovel
|
794 |
+
shower cap
|
795 |
+
shower curtain
|
796 |
+
ski
|
797 |
+
ski mask
|
798 |
+
sleeping bag
|
799 |
+
slide rule
|
800 |
+
sliding door
|
801 |
+
slot
|
802 |
+
snorkel
|
803 |
+
snowmobile
|
804 |
+
snowplow
|
805 |
+
soap dispenser
|
806 |
+
soccer ball
|
807 |
+
sock
|
808 |
+
solar dish
|
809 |
+
sombrero
|
810 |
+
soup bowl
|
811 |
+
space bar
|
812 |
+
space heater
|
813 |
+
space shuttle
|
814 |
+
spatula
|
815 |
+
speedboat
|
816 |
+
spider web
|
817 |
+
spindle
|
818 |
+
sports car
|
819 |
+
spotlight
|
820 |
+
stage
|
821 |
+
steam locomotive
|
822 |
+
steel arch bridge
|
823 |
+
steel drum
|
824 |
+
stethoscope
|
825 |
+
stole
|
826 |
+
stone wall
|
827 |
+
stopwatch
|
828 |
+
stove
|
829 |
+
strainer
|
830 |
+
streetcar
|
831 |
+
stretcher
|
832 |
+
studio couch
|
833 |
+
stupa
|
834 |
+
submarine
|
835 |
+
suit
|
836 |
+
sundial
|
837 |
+
sunglass
|
838 |
+
sunglasses
|
839 |
+
sunscreen
|
840 |
+
suspension bridge
|
841 |
+
swab
|
842 |
+
sweatshirt
|
843 |
+
swimming trunks
|
844 |
+
swing
|
845 |
+
switch
|
846 |
+
syringe
|
847 |
+
table lamp
|
848 |
+
tank
|
849 |
+
tape player
|
850 |
+
teapot
|
851 |
+
teddy
|
852 |
+
television
|
853 |
+
tennis ball
|
854 |
+
thatch
|
855 |
+
theater curtain
|
856 |
+
thimble
|
857 |
+
thresher
|
858 |
+
throne
|
859 |
+
tile roof
|
860 |
+
toaster
|
861 |
+
tobacco shop
|
862 |
+
toilet seat
|
863 |
+
torch
|
864 |
+
totem pole
|
865 |
+
tow truck
|
866 |
+
toyshop
|
867 |
+
tractor
|
868 |
+
trailer truck
|
869 |
+
tray
|
870 |
+
trench coat
|
871 |
+
tricycle
|
872 |
+
trimaran
|
873 |
+
tripod
|
874 |
+
triumphal arch
|
875 |
+
trolleybus
|
876 |
+
trombone
|
877 |
+
tub
|
878 |
+
turnstile
|
879 |
+
typewriter keyboard
|
880 |
+
umbrella
|
881 |
+
unicycle
|
882 |
+
upright
|
883 |
+
vacuum
|
884 |
+
vase
|
885 |
+
vault
|
886 |
+
velvet
|
887 |
+
vending machine
|
888 |
+
vestment
|
889 |
+
viaduct
|
890 |
+
violin
|
891 |
+
volleyball
|
892 |
+
waffle iron
|
893 |
+
wall clock
|
894 |
+
wallet
|
895 |
+
wardrobe
|
896 |
+
warplane
|
897 |
+
washbasin
|
898 |
+
washer
|
899 |
+
water bottle
|
900 |
+
water jug
|
901 |
+
water tower
|
902 |
+
whiskey jug
|
903 |
+
whistle
|
904 |
+
wig
|
905 |
+
window screen
|
906 |
+
window shade
|
907 |
+
Windsor tie
|
908 |
+
wine bottle
|
909 |
+
wing
|
910 |
+
wok
|
911 |
+
wooden spoon
|
912 |
+
wool
|
913 |
+
worm fence
|
914 |
+
wreck
|
915 |
+
yawl
|
916 |
+
yurt
|
917 |
+
web site
|
918 |
+
comic book
|
919 |
+
crossword puzzle
|
920 |
+
street sign
|
921 |
+
traffic light
|
922 |
+
book jacket
|
923 |
+
menu
|
924 |
+
plate
|
925 |
+
guacamole
|
926 |
+
consomme
|
927 |
+
hot pot
|
928 |
+
trifle
|
929 |
+
ice cream
|
930 |
+
ice lolly
|
931 |
+
French loaf
|
932 |
+
bagel
|
933 |
+
pretzel
|
934 |
+
cheeseburger
|
935 |
+
hotdog
|
936 |
+
mashed potato
|
937 |
+
head cabbage
|
938 |
+
broccoli
|
939 |
+
cauliflower
|
940 |
+
zucchini
|
941 |
+
spaghetti squash
|
942 |
+
acorn squash
|
943 |
+
butternut squash
|
944 |
+
cucumber
|
945 |
+
artichoke
|
946 |
+
bell pepper
|
947 |
+
cardoon
|
948 |
+
mushroom
|
949 |
+
Granny Smith
|
950 |
+
strawberry
|
951 |
+
orange
|
952 |
+
lemon
|
953 |
+
fig
|
954 |
+
pineapple
|
955 |
+
banana
|
956 |
+
jackfruit
|
957 |
+
custard apple
|
958 |
+
pomegranate
|
959 |
+
hay
|
960 |
+
carbonara
|
961 |
+
chocolate sauce
|
962 |
+
dough
|
963 |
+
meat loaf
|
964 |
+
pizza
|
965 |
+
potpie
|
966 |
+
burrito
|
967 |
+
red wine
|
968 |
+
espresso
|
969 |
+
cup
|
970 |
+
eggnog
|
971 |
+
alp
|
972 |
+
bubble
|
973 |
+
cliff
|
974 |
+
coral reef
|
975 |
+
geyser
|
976 |
+
lakeside
|
977 |
+
promontory
|
978 |
+
sandbar
|
979 |
+
seashore
|
980 |
+
valley
|
981 |
+
volcano
|
982 |
+
ballplayer
|
983 |
+
groom
|
984 |
+
scuba diver
|
985 |
+
rapeseed
|
986 |
+
daisy
|
987 |
+
yellow lady's slipper
|
988 |
+
corn
|
989 |
+
acorn
|
990 |
+
hip
|
991 |
+
buckeye
|
992 |
+
coral fungus
|
993 |
+
agaric
|
994 |
+
gyromitra
|
995 |
+
stinkhorn
|
996 |
+
earthstar
|
997 |
+
hen-of-the-woods
|
998 |
+
bolete
|
999 |
+
ear
|
1000 |
+
toilet tissue
|
model.py
ADDED
@@ -0,0 +1,164 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
from torch.utils.data import DataLoader
|
3 |
+
from torchvision import transforms
|
4 |
+
import numpy as np
|
5 |
+
import pandas as pd
|
6 |
+
import os
|
7 |
+
import cv2
|
8 |
+
from sklearn.utils import shuffle
|
9 |
+
from sklearn.model_selection import train_test_split
|
10 |
+
import torch
|
11 |
+
import torch.nn as nn
|
12 |
+
import torch.nn.functional as F
|
13 |
+
import torchvision.transforms as transforms
|
14 |
+
import torch
|
15 |
+
import torch.nn as nn
|
16 |
+
|
17 |
+
|
18 |
+
class HybridCNNViT(nn.Module):
|
19 |
+
def __init__(self, in_channels: int, num_classes: int):
|
20 |
+
super(HybridCNNViT, self).__init__()
|
21 |
+
|
22 |
+
self.conv1 = nn.Conv2d(
|
23 |
+
in_channels, 64, kernel_size=7, stride=2, padding=3, bias=False)
|
24 |
+
self.bn1 = nn.BatchNorm2d(64)
|
25 |
+
self.relu = nn.ReLU(inplace=True)
|
26 |
+
|
27 |
+
self.conv2 = nn.Conv2d(64, 128, kernel_size=3,
|
28 |
+
stride=1, padding=1, bias=False)
|
29 |
+
self.bn2 = nn.BatchNorm2d(128)
|
30 |
+
|
31 |
+
self.conv3 = nn.Conv2d(128, 128, kernel_size=3,
|
32 |
+
stride=1, padding=1, bias=False)
|
33 |
+
self.bn3 = nn.BatchNorm2d(128)
|
34 |
+
|
35 |
+
self.conv4 = nn.Conv2d(128, 256, kernel_size=3,
|
36 |
+
stride=2, padding=1, bias=False)
|
37 |
+
self.bn4 = nn.BatchNorm2d(256)
|
38 |
+
|
39 |
+
self.conv5 = nn.Conv2d(256, 256, kernel_size=3,
|
40 |
+
stride=1, padding=1, bias=False)
|
41 |
+
self.bn5 = nn.BatchNorm2d(256)
|
42 |
+
|
43 |
+
self.conv6 = nn.Conv2d(256, 512, kernel_size=3,
|
44 |
+
stride=1, padding=1, bias=False)
|
45 |
+
self.bn6 = nn.BatchNorm2d(512)
|
46 |
+
|
47 |
+
self.conv7 = nn.Conv2d(512, 512, kernel_size=3,
|
48 |
+
stride=2, padding=1, bias=False)
|
49 |
+
self.bn7 = nn.BatchNorm2d(512)
|
50 |
+
|
51 |
+
# Optional MaxPooling (can be removed if strictly no max pooling)
|
52 |
+
self.maxpool = nn.MaxPool2d(kernel_size=2, stride=2)
|
53 |
+
|
54 |
+
self.classifier_conv = nn.Conv2d(
|
55 |
+
512, num_classes, kernel_size=1, stride=1, padding=0, bias=False)
|
56 |
+
|
57 |
+
self.classifier = nn.Sequential(
|
58 |
+
nn.AdaptiveAvgPool2d((1, 1)),
|
59 |
+
nn.Flatten(),
|
60 |
+
nn.Dropout(0.5)
|
61 |
+
)
|
62 |
+
|
63 |
+
def forward(self, x: torch.Tensor) -> torch.Tensor:
|
64 |
+
x = self.relu(self.bn1(self.conv1(x)))
|
65 |
+
x = self.relu(self.bn2(self.conv2(x)))
|
66 |
+
x = self.relu(self.bn3(self.conv3(x)))
|
67 |
+
x = self.relu(self.bn4(self.conv4(x)))
|
68 |
+
x = self.relu(self.bn5(self.conv5(x)))
|
69 |
+
x = self.relu(self.bn6(self.conv6(x)))
|
70 |
+
x = self.relu(self.bn7(self.conv7(x)))
|
71 |
+
|
72 |
+
x = self.maxpool(x) # Comment this line if no max pooling is needed
|
73 |
+
|
74 |
+
x = self.classifier_conv(x)
|
75 |
+
x = self.classifier(x)
|
76 |
+
|
77 |
+
return x
|
78 |
+
|
79 |
+
|
80 |
+
def load_and_pad_single_image(image_path, img_size=(224, 224)):
|
81 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
82 |
+
img = cv2.imread(image_path)
|
83 |
+
if img is None:
|
84 |
+
raise ValueError(f"Could not read image: {image_path}")
|
85 |
+
img = cv2.resize(img, img_size)
|
86 |
+
return np.array(img)
|
87 |
+
|
88 |
+
|
89 |
+
def check_file(image_path):
|
90 |
+
# image_path = "d/Control-Axial/C-A (2).png"
|
91 |
+
|
92 |
+
# Load and preprocess the single image
|
93 |
+
image = load_and_pad_single_image(image_path)
|
94 |
+
image = np.expand_dims(image, axis=0) # Convert to batch format
|
95 |
+
|
96 |
+
# Duplicate the image 10 times
|
97 |
+
data = np.repeat(image, 10, axis=0)
|
98 |
+
|
99 |
+
# Normalize and transform the image
|
100 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
101 |
+
transform = transforms.Compose([
|
102 |
+
transforms.ToTensor(),
|
103 |
+
transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[
|
104 |
+
0.229, 0.224, 0.225])
|
105 |
+
])
|
106 |
+
|
107 |
+
data = torch.tensor(data, dtype=torch.float32).permute(
|
108 |
+
0, 3, 1, 2).to(device)
|
109 |
+
# Placeholder labels for 10 images
|
110 |
+
labels = torch.tensor([0] * 10, dtype=torch.long).to(device)
|
111 |
+
|
112 |
+
data, labels = shuffle(data, labels, random_state=42)
|
113 |
+
|
114 |
+
train_data, test_data, train_labels, test_labels = train_test_split(
|
115 |
+
data, labels, test_size=0.2, random_state=42
|
116 |
+
)
|
117 |
+
|
118 |
+
train_labels = torch.tensor(train_labels, dtype=torch.long)
|
119 |
+
test_labels = torch.tensor(test_labels, dtype=torch.long)
|
120 |
+
|
121 |
+
batch_size = 1 # Since we are working with a single image
|
122 |
+
train_dataset = list(zip(train_data, train_labels))
|
123 |
+
test_dataset = list(zip(test_data, test_labels))
|
124 |
+
test_loader = DataLoader(
|
125 |
+
test_dataset, batch_size=batch_size, shuffle=False)
|
126 |
+
|
127 |
+
# Simple test with a model
|
128 |
+
output = ""
|
129 |
+
|
130 |
+
def test_model(model, test_loader, device):
|
131 |
+
global output
|
132 |
+
model.to(device)
|
133 |
+
model.eval()
|
134 |
+
with torch.no_grad():
|
135 |
+
for images, labels in test_loader:
|
136 |
+
images, labels = images.to(device), labels.to(device)
|
137 |
+
outputs = model(images)
|
138 |
+
_, predicted = torch.max(outputs.data, 1)
|
139 |
+
output = predicted
|
140 |
+
# Convert logits to probabilities
|
141 |
+
probabilities = F.softmax(outputs, dim=1)
|
142 |
+
# Get confidence score and prediction
|
143 |
+
confidence, d = torch.max(probabilities, 1)
|
144 |
+
print(confidence)
|
145 |
+
return predicted, confidence
|
146 |
+
|
147 |
+
def remove_module_from_checkpoint(checkpoint):
|
148 |
+
new_state_dict = {}
|
149 |
+
for key, value in checkpoint["model_state_dict"].items():
|
150 |
+
new_key = key.replace("module.", "")
|
151 |
+
new_state_dict[new_key] = value
|
152 |
+
checkpoint["model_state_dict"] = new_state_dict
|
153 |
+
return checkpoint
|
154 |
+
|
155 |
+
model = HybridCNNViT(3, 2)
|
156 |
+
checkpoint = torch.load(
|
157 |
+
"/home/user/app/checkpoint32.pth", weights_only=False, map_location=torch.device('cpu'))
|
158 |
+
checkpoint = remove_module_from_checkpoint(checkpoint)
|
159 |
+
model.load_state_dict(checkpoint['model_state_dict'])
|
160 |
+
model.eval()
|
161 |
+
model.to(device)
|
162 |
+
model = nn.DataParallel(model)
|
163 |
+
output, confidence = test_model(model, test_loader, device)
|
164 |
+
return "No ms detected" if output.item() == 0 else "MS Detected", confidence.item()
|
requirements.txt
CHANGED
@@ -22,3 +22,7 @@ openai
|
|
22 |
fpdf
|
23 |
cloudinary
|
24 |
PyPDF2
|
|
|
|
|
|
|
|
|
|
22 |
fpdf
|
23 |
cloudinary
|
24 |
PyPDF2
|
25 |
+
scikit-learn
|
26 |
+
pandas
|
27 |
+
gdown
|
28 |
+
nibabel
|
temp.py
CHANGED
@@ -17,7 +17,8 @@ import torch
|
|
17 |
app = Flask(__name__)
|
18 |
cfg = None
|
19 |
# Google Drive file URL
|
20 |
-
|
|
|
21 |
LOCAL_MODEL_PATH = "model_final.pth"
|
22 |
|
23 |
|
@@ -25,8 +26,8 @@ def download_file_from_google_drive(id, destination):
|
|
25 |
gdown.download(GDRIVE_MODEL_URL, LOCAL_MODEL_PATH, quiet=False)
|
26 |
|
27 |
|
28 |
-
file_id = "
|
29 |
-
destination = "
|
30 |
download_file_from_google_drive(file_id, destination)
|
31 |
|
32 |
|
@@ -109,7 +110,8 @@ def upload():
|
|
109 |
if j in merged_boxes:
|
110 |
continue
|
111 |
iou = box_iou(
|
112 |
-
torch.tensor(boxes[i]).unsqueeze(
|
|
|
113 |
).item()
|
114 |
if iou > iou_threshold:
|
115 |
merged_boxes.add(j)
|
@@ -150,8 +152,6 @@ def fetchImage():
|
|
150 |
image = skio.imread(file)
|
151 |
image_np = image
|
152 |
|
153 |
-
|
154 |
-
|
155 |
return jsonify(response)
|
156 |
|
157 |
|
|
|
17 |
app = Flask(__name__)
|
18 |
cfg = None
|
19 |
# Google Drive file URL
|
20 |
+
# Replace 'your-file-id' with the actual file ID from Google Drive
|
21 |
+
GDRIVE_MODEL_URL = "https://drive.google.com/uc?id=1fzKneepaRt_--dzamTcDBM-9d3_dLX7z"
|
22 |
LOCAL_MODEL_PATH = "model_final.pth"
|
23 |
|
24 |
|
|
|
26 |
gdown.download(GDRIVE_MODEL_URL, LOCAL_MODEL_PATH, quiet=False)
|
27 |
|
28 |
|
29 |
+
file_id = "1fzKneepaRt_--dzamTcDBM-9d3_dLX7z"
|
30 |
+
destination = "checkpoint32.pth"
|
31 |
download_file_from_google_drive(file_id, destination)
|
32 |
|
33 |
|
|
|
110 |
if j in merged_boxes:
|
111 |
continue
|
112 |
iou = box_iou(
|
113 |
+
torch.tensor(boxes[i]).unsqueeze(
|
114 |
+
0), torch.tensor(boxes[j]).unsqueeze(0)
|
115 |
).item()
|
116 |
if iou > iou_threshold:
|
117 |
merged_boxes.add(j)
|
|
|
152 |
image = skio.imread(file)
|
153 |
image_np = image
|
154 |
|
|
|
|
|
155 |
return jsonify(response)
|
156 |
|
157 |
|
test.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import cv2
|
2 |
+
import numpy as np
|
3 |
+
|
4 |
+
|
5 |
+
def is_mri_image(image_path):
|
6 |
+
img = cv2.imread(image_path, cv2.IMREAD_GRAYSCALE)
|
7 |
+
|
8 |
+
if img is None:
|
9 |
+
return False # Invalid image
|
10 |
+
|
11 |
+
# Apply Canny edge detection
|
12 |
+
edges = cv2.Canny(img, 50, 150)
|
13 |
+
|
14 |
+
# Calculate edge density (MRI images have high edge presence)
|
15 |
+
edge_density = np.sum(edges > 0) / edges.size
|
16 |
+
print(edge_density)
|
17 |
+
return edge_density > 0.05 # Threshold from MRI dataset
|
18 |
+
|
19 |
+
|
20 |
+
# Test on an MRI or non-MRI image
|
21 |
+
print(is_mri_image("a.png"))
|