Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
iscyy committed Aug 17, 2022
1 parent 4283fc6 commit 0ca7cf8
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 274 deletions.
43 changes: 0 additions & 43 deletions configs/yolov6/yolov6l.yaml

This file was deleted.

8 changes: 0 additions & 8 deletions models/yolo.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from copy import deepcopy
from pathlib import Path
from models.yolox import DetectX, DetectYoloX
from models.yolov6 import Detectv6
from models.Detect.MuitlHead import Decoupled_Detect, ASFF_Detect, IDetect, IAuxDetect
from utils.loss import ComputeLoss, ComputeNWDLoss, ComputeXLoss

Expand Down Expand Up @@ -129,10 +128,6 @@ def __init__(self, cfg='yolov5s.yaml', ch=3, nc=None, anchors=None): # model, i
m.initialize_biases() # only run once
self.model_type = 'yolox'
self.loss_category = ComputeXLoss # use ComputeXLoss
if isinstance(m, Detectv6):
m.inplace = self.inplace
self.stride = torch.tensor(m.stride)
m.initialize_biases() # only run once
if isinstance(m, Decoupled_Detect)or isinstance(m, ASFF_Detect) :
s = 256 # 2x min stride
m.inplace = self.inplace
Expand Down Expand Up @@ -431,9 +426,6 @@ def parse_model(d, ch): # model_dict, input_channels(3)
args[1] = [list(range(args[1] * 2))] * len(f)
elif m in {DetectX, DetectYoloX}:
args.append([ch[x] for x in f])
elif m in [Detectv6]:
args.append([ch[x] for x in f])
args = args[:2]
elif m is Contract: # no
c2 = ch[f] * args[0] ** 2
elif m is MobileOne:
Expand Down
216 changes: 0 additions & 216 deletions models/yolov6.py

This file was deleted.

5 changes: 1 addition & 4 deletions train.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
print_args, print_mutation, strip_optimizer)
from utils.loggers import Loggers
from utils.loggers.wandb.wandb_utils import check_wandb_resume
from utils.loss import ComputeLoss, ComputeNWDLoss, ComputeLossOTA, ComputeLossAuxOTA, ComputeLossBinOTA, Computev6Loss
from utils.loss import ComputeLoss, ComputeNWDLoss, ComputeLossOTA, ComputeLossAuxOTA, ComputeLossBinOTA
from utils.metrics import fitness
from utils.plots import plot_evolve, plot_labels
from utils.torch_utils import EarlyStopping, ModelEMA, de_parallel, is_parallel, select_device, torch_distributed_zero_first
Expand Down Expand Up @@ -293,8 +293,6 @@ def train(hyp, # path/to/hyp.yaml or hyp dictionary
compute_loss = loss_category(model)# loss class
if opt.loss == 'nwd':
compute_loss = ComputeNWDLoss(model) # nwdloss class
if opt.v6:
compute_loss = Computev6Loss()
LOGGER.info(f'Image sizes {imgsz} train, {imgsz} val\n'
f'Using {train_loader.num_workers * WORLD_SIZE} dataloader workers\n'
f"Logging results to {colorstr('bold', save_dir)}\n"
Expand Down Expand Up @@ -507,7 +505,6 @@ def parse_opt(known=False):
parser.add_argument('--loss', type=str, default='origin', help='')
parser.add_argument('--auxotaloss', action='store_true', help='swin not use half to train/Val')
parser.add_argument('--otaloss', action='store_true', help='swin not use half to train/Val')
parser.add_argument('--v6', action='store_true', help='')
parser.add_argument('--batch-size', type=int, default=2, help='total batch size for all GPUs, -1 for autobatch')
parser.add_argument('--imgsz', '--img', '--img-size', type=int, default=160, help='train, val image size (pixels)')
parser.add_argument('--rect', action='store_true', help='rectangular training')
Expand Down
6 changes: 3 additions & 3 deletions utils/yolov6official.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import torch.nn.functional as F


class Computev6Loss:
class ComputeLoss_meituanv6:
'''Loss computation func.
This func contains SimOTA and siou loss.
'''
Expand Down Expand Up @@ -41,7 +41,7 @@ def __init__(self,
# Define criteria
self.l1_loss = nn.L1Loss(reduction="none")
self.bcewithlog_loss = nn.BCEWithLogitsLoss(reduction="none")
self.iou_loss = IOUv6loss(iou_type=iou_type, reduction="none")
self.iou_loss = IOUloss_meituanv6(iou_type=iou_type, reduction="none")

def __call__(
self,
Expand Down Expand Up @@ -411,7 +411,7 @@ def dynamic_k_matching(self, cost, pair_wise_ious, gt_classes, num_gt, fg_mask):

return num_fg, gt_matched_classes, pred_ious_this_matching, matched_gt_inds

class IOUv6loss:
class IOUloss_meituanv6:
""" Calculate IoU loss.
"""
def __init__(self, box_format='xywh', iou_type='ciou', reduction='none', eps=1e-7):
Expand Down

0 comments on commit 0ca7cf8

Please sign in to comment.