프로젝트

일반

사용자정보

개정판 dd6d4de9

IDdd6d4de90f12becf88c718f36509e0184df462a3
상위 1473bff5
하위 66fb1230, a15603c2, ca84c19d

함의성이(가) 4년 이상 전에 추가함

issue #1366: merge

차이점 보기:

DTI_PID/WebServer/run.py
1 1
from app import app
2 2

  
3 3
if __name__ == '__main__':
4
    app.run(port=8080, debug=False)#, host='0.0.0.0')
4
    app.run(port=8080, debug=True, host='0.0.0.0')
5 5
    #app.run(debug=False)
DTI_PID/WebServer/symbol_training/src/doftech_dataset.py
20 20
        self.use_rotation = True
21 21

  
22 22
        self.data_path = root_path
23
        self.img_path = root_path+'/images/'
23
        self.img_path = root_path+'/img/'
24 24
        self.xml_path = root_path + '/xml/'
25 25
        self.img_path_list = sorted([item for sublist in [glob.glob(self.img_path + ext) for ext in ["*.jpg", "*.png"]] for item in sublist])#sorted(glob.glob(os.path.join(self.img_path, '*.jpg')))
26 26

  
DTI_PID/WebServer/symbol_training/train.py
5 5
import argparse
6 6
import torch.nn as nn
7 7
from torch.utils.data import DataLoader
8
from src.doftech_dataset import DoftechDataset, DoftechDatasetTest
8
from src.doftech_dataset import DoftechDataset
9 9
from src.utils import *
10 10
from src.loss import YoloLoss
11 11
from src.yolo_net import Yolo
......
147 147
            loss.backward()
148 148
            optimizer.step()
149 149

  
150
            if iter % opt.test_interval == 0:
150
            if iter % (opt.test_interval * 5) == 0:
151 151
                print("Epoch: {}/{}, Iteration: {}/{}, Lr: {}, Loss:{:.5f} (Coord:{:.5f} Conf:{:.5f} Cls:{:.5f})".format
152 152
                    (epoch + 1, opt.num_epoches, iter + 1, num_iter_per_epoch, optimizer.param_groups[0]['lr'], loss,
153 153
                    loss_coord,loss_conf,loss_cls))
......
191 191
            loss_conf_ls = []
192 192
            loss_cls_ls = []
193 193
            for te_iter, te_batch in enumerate(test_generator):
194
                te_image, te_label = te_batch
194
                te_image, te_label, _ = te_batch
195 195
                num_sample = len(te_label)
196 196
                if torch.cuda.is_available():
197 197
                    te_image = te_image.cuda()
......
217 217
                best_epoch = epoch
218 218
                print("SAVE MODEL")
219 219
                # for debug for each loss
220
                #torch.save(model.state_dict(), os.path.join(opt.saved_path, name + "_only_params_" + str(save_count) + "_" + "{:.5f}".format(best_loss) + ".pth"))
220
                torch.save(model.state_dict(), os.path.join(opt.saved_path, name + "_only_params_" + str(save_count) + "_" + "{:.5f}".format(best_loss) + ".pth"))
221 221
                #torch.save(model, os.path.join(opt.saved_path, name + "_whole_model_" + str(save_count) + "_" + "{:.5f}".format(best_loss) + ".pth"))
222 222
                # save
223 223
                torch.save(model.state_dict(), os.path.join(opt.saved_path, name + "_only_params.pth"))
......
226 226
                save_count += 1
227 227
                # for debug for each loss
228 228
                torch.save(model.state_dict(), os.path.join(opt.saved_path, name + "_only_params_" + str(save_count) + "_" + "{:.5f}".format(te_loss) + ".pth"))
229
                torch.save(model, os.path.join(opt.saved_path, name + "_whole_model_" + str(save_count) + "_" + "{:.5f}".format(te_loss) + ".pth"))
229
                #torch.save(model, os.path.join(opt.saved_path, name + "_whole_model_" + str(save_count) + "_" + "{:.5f}".format(te_loss) + ".pth"))
230 230

  
231 231
            # Early stopping
232 232
            if epoch - best_epoch > opt.es_patience > 0:

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)