fixed a critical mistake, misaligned neural network
@0106b7baecee1d51788a0c71bc312453e2ce828d
--- action.py
+++ action.py
... | ... | @@ -20,9 +20,9 @@ |
20 | 20 |
arnn.load_state_dict(torch.load("weights/ARNN_trained_weight_6_3_2.pt")) |
21 | 21 |
arnn.to(device=device) |
22 | 22 |
|
23 |
-classifier = Classifier() |
|
23 |
+classifier = Classifier(in_ch=1) |
|
24 | 24 |
classifier.eval() |
25 |
-classifier.load_state_dict(torch.load("weights/Classifier_512.pt")) |
|
25 |
+classifier.load_state_dict(torch.load("weights/classifier_e19_weight_1080p_512512_fixed_wrong_resolution_and_ch.pt")) |
|
26 | 26 |
classifier.to(device=device) |
27 | 27 |
|
28 | 28 |
tf_toTensor = ToTensor() |
... | ... | @@ -69,7 +69,7 @@ |
69 | 69 |
image_arnn = arnn(image_tensor) |
70 | 70 |
image_tensor.cpu() |
71 | 71 |
del image_tensor |
72 |
- result = classifier(image_arnn['x']) |
|
72 |
+ result = classifier(image_arnn['attention_map_list'][-1]) |
|
73 | 73 |
image_arnn['x'].cpu() |
74 | 74 |
del image_arnn |
75 | 75 |
|
--- app.py
+++ app.py
... | ... | @@ -18,5 +18,5 @@ |
18 | 18 |
api.add_namespace(Action, '/action') |
19 | 19 |
|
20 | 20 |
if __name__ == "__main__": |
21 |
- app.run(debug=False, host='0.0.0.0', port=8000) |
|
21 |
+ app.run(debug=False, host='0.0.0.0', port=7700) |
|
22 | 22 |
print("Flask Start")(파일 끝에 줄바꿈 문자 없음) |
--- demonstration.py
+++ demonstration.py
... | ... | @@ -38,7 +38,8 @@ |
38 | 38 |
random.shuffle(img_path) |
39 | 39 |
|
40 | 40 |
for i in iter(range(len(img_path))): |
41 |
- image = crop_image(img_path[i], crop_size, start_point) |
|
41 |
+ ori_img = cv2.imread(img_path[i]) |
|
42 |
+ image = crop_image(ori_img, crop_size, start_point) |
|
42 | 43 |
if not image.any(): |
43 | 44 |
continue |
44 | 45 |
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) |
--- model/AttentiveRNN.py
+++ model/AttentiveRNN.py
... | ... | @@ -217,8 +217,8 @@ |
217 | 217 |
lstm_feats.append(lstm_feats_i) |
218 | 218 |
ret = { |
219 | 219 |
'x' : x, |
220 |
- # 'attention_map_list' : attention_map, |
|
221 |
- # 'lstm_feats' : lstm_feats |
|
220 |
+ 'attention_map_list' : attention_map, |
|
221 |
+ 'lstm_feats' : lstm_feats |
|
222 | 222 |
} |
223 | 223 |
return ret |
224 | 224 |
|
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?