os.path.join(cfg.TRAIN_DIR, 'runs', cfg.exp_name)) else: summary_writer = None batch_per_epoch = imdb.batch_per_epoch train_loss = 0 bbox_loss, iou_loss, cls_loss = 0., 0., 0. cnt = 0 t = Timer() step_cnt = 0 size_index = 0 for step in range(start_epoch * imdb.batch_per_epoch, cfg.max_epoch * imdb.batch_per_epoch): t.tic() # batch batch = imdb.next_batch(size_index) im = batch['images'] gt_boxes = batch['gt_boxes'] gt_classes = batch['gt_classes'] dontcare = batch['dontcare'] orgin_im = batch['origin_im'] # forward im_data = net_utils.np_to_variable(im, is_cuda=True, volatile=False).permute(0, 3, 1, 2) bbox_pred, iou_pred, prob_pred = net(im_data, gt_boxes, gt_classes, dontcare, size_index) # backward loss = net.loss bbox_loss += net.bbox_loss.data.cpu().numpy()
pass exp = cc.create_experiment(cfg.exp_name) else: exp = cc.open_experiment(cfg.exp_name) batch_per_epoch = imdb.batch_per_epoch train_loss = 0 bbox_loss, iou_loss, cls_loss = 0., 0., 0. cnt = 0 t = Timer() step_cnt = 0 for step in range(start_epoch * imdb.batch_per_epoch, cfg.max_epoch * imdb.batch_per_epoch): t.tic() # batch batch = imdb.next_batch() im = batch['images'] gt_boxes = batch['gt_boxes'] gt_classes = batch['gt_classes'] dontcare = batch['dontcare'] orgin_im = batch['origin_im'] # forward im_data = net_utils.np_to_variable(im, is_cuda=True, volatile=False).permute(0, 3, 1, 2) net(im_data, gt_boxes, gt_classes, dontcare) # backward loss = net.loss bbox_loss += net.bbox_loss.data.cpu().numpy()[0] iou_loss += net.iou_loss.data.cpu().numpy()[0]