Skip to content

Commit e726921

Browse files
authored
feat: update minor (#27)
1 parent 3185477 commit e726921

File tree

8 files changed

+21
-9
lines changed

8 files changed

+21
-9
lines changed

deploy/ONNX/export_onnx.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
parser.add_argument('--batch-size', type=int, default=1, help='batch size')
2727
parser.add_argument('--half', action='store_true', help='FP16 half-precision export')
2828
parser.add_argument('--inplace', action='store_true', help='set Detect() inplace=True')
29-
parser.add_argument('--device', default='0', help='cuda device, i.e. 0 or 0,1,2,3 or cpu')
29+
parser.add_argument('--device', default='0', help='cuda device, i.e. 0 or 0, 1, 2, 3 or cpu')
3030
args = parser.parse_args()
3131
args.img_size *= 2 if len(args.img_size) == 1 else 1 # expand
3232
print(args)

yolov6/core/evaler.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ def init_model(self, model, weights, task):
6161

6262
def init_data(self, dataloader, task):
6363
'''Initialize dataloader.
64-
6564
Returns a dataloader for task val or speed.
6665
'''
6766
self.is_coco = isinstance(self.data.get('val'), str) and 'coco' in self.data['val'] # COCO dataset
@@ -104,10 +103,10 @@ def predict_model(self, model, dataloader, task):
104103
return pred_results
105104

106105
def eval_model(self, pred_results, model, dataloader, task):
107-
'''Evaluate current model
108-
For task speed, this function only evaluates the speed of model and output inference time.
109-
For task val, this function evalutates the speed and also evaluates mAP by pycocotools, and then
110-
returns inference time and mAP value.
106+
'''Evaluate models
107+
For task speed, this function only evaluates the speed of model and outputs inference time.
108+
For task val, this function evalutates the speed and mAP by pycocotools, and returns
109+
inference time and mAP value.
111110
'''
112111
LOGGER.info(f'\nEvaluating speed.')
113112
self.eval_speed(task)
@@ -145,7 +144,7 @@ def eval_model(self, pred_results, model, dataloader, task):
145144
return (0.0, 0.0)
146145

147146
def eval_speed(self, task):
148-
'''Evaluate the speed of model.'''
147+
'''Evaluate model inference speed.'''
149148
if task != 'train':
150149
n_samples = self.speed_result[0].item()
151150
pre_time, inf_time, nms_time = 1000 * self.speed_result[1:].cpu().numpy() / n_samples
@@ -215,7 +214,7 @@ def check_task(task):
215214

216215
@staticmethod
217216
def reload_thres(conf_thres, iou_thres, task):
218-
'''Sets conf and iou thres for task val/speed'''
217+
'''Sets conf and iou threshold for task val/speed'''
219218
if task != 'train':
220219
if task == 'val':
221220
conf_thres = 0.001

yolov6/models/effidehead.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55

66

77
class Detect(nn.Module):
8-
'''Efficient Decoupled Head'''
8+
'''Efficient Decoupled Head
9+
With hardware-aware degisn, the decoupled head is optimized with
10+
hybridchannels methods.
11+
'''
912
def __init__(self, num_classes=80, anchors=1, num_layers=3, inplace=True, head_layers=None): # detection layer
1013
super().__init__()
1114
assert head_layers is not None

yolov6/models/yolo.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010

1111

1212
class Model(nn.Module):
13+
'''YOLOv6 model with backbone, neck and head.
14+
The default parts are EfficientRep Backbone, Rep-PAN and
15+
Efficient Decoupled Head.
16+
'''
1317
def __init__(self, config, channels=3, num_classes=None, anchors=None): # model, input channels, number of classes
1418
super().__init__()
1519
# Build network

yolov6/utils/checkpoint.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from yolov6.utils.events import LOGGER
88
from yolov6.utils.torch_utils import fuse_model
99

10+
1011
def load_state_dict(weights, model, map_location=None):
1112
"""Load weights from checkpoint file, only assign weights those layers' name and shape are match."""
1213
ckpt = torch.load(weights, map_location=map_location)

yolov6/utils/ema.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import torch
88
import torch.nn as nn
99

10+
1011
class ModelEMA:
1112
""" Model Exponential Moving Average from https://github.com/rwightman/pytorch-image-models
1213
Keep a moving average of everything in the model state_dict (parameters and buffers).

yolov6/utils/envs.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import torch.backends.cudnn as cudnn
99
from yolov6.utils.events import LOGGER
1010

11+
1112
def get_envs():
1213
"""Get PyTorch needed environments from system envirionments."""
1314
local_rank = int(os.getenv('LOCAL_RANK', -1))

yolov6/utils/events.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@
55
import logging
66
import shutil
77

8+
89
def set_logging(name=None):
910
rank = int(os.getenv('RANK', -1))
1011
logging.basicConfig(format="%(message)s", level=logging.INFO if (rank in (-1, 0)) else logging.WARNING)
1112
return logging.getLogger(name)
1213

14+
1315
LOGGER = set_logging(__name__)
1416
NCOLS = shutil.get_terminal_size().columns
1517

18+
1619
def load_yaml(file_path):
1720
"""Load data from yaml file."""
1821
if isinstance(file_path, str):

0 commit comments

Comments
 (0)