Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
glenn-jocher committed Jan 22, 2020
1 parent 6ccf190 commit 5d73b19
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
8 changes: 2 additions & 6 deletions models.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,13 @@ def create_modules(module_defs, img_size, arc):

# Initialize preceding Conv2d() bias (https://arxiv.org/pdf/1708.02002.pdf section 3.3)
try:
if arc == 'defaultpw' or arc == 'Fdefaultpw': # default with positive weights
if arc == 'default' or arc == 'Fdefault': # default
b = [-5.0, -5.0] # obj, cls
elif arc == 'default': # default no pw (40 cls, 80 obj)
b = [-5.0, -5.0]
elif arc == 'uBCE': # unified BCE (80 classes)
b = [0, -9.0]
elif arc == 'uCE': # unified CE (1 background + 80 classes)
b = [10, -0.1]
elif arc == 'Fdefault': # Focal default no pw (28 cls, 21 obj, no pw)
b = [-2.1, -1.8]
elif arc == 'uFBCE' or arc == 'uFBCEpw': # unified FocalBCE (5120 obj, 80 classes)
elif arc == 'uFBCE': # unified FocalBCE (5120 obj, 80 classes)
b = [0, -6.5]
elif arc == 'uFCE': # unified FocalCE (64 cls, 1 background + 80 classes)
b = [7.7, -1.1]
Expand Down
6 changes: 1 addition & 5 deletions train.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ def train():
accumulate = opt.accumulate # effective bs = batch_size * accumulate = 16 * 4 = 64
weights = opt.weights # initial training weights

if 'pw' not in opt.arc: # remove BCELoss positive weights
hyp['cls_pw'] = 1.
hyp['obj_pw'] = 1.

# Initialize
init_seeds()
if opt.multi_scale:
Expand Down Expand Up @@ -413,7 +409,7 @@ def train():
parser.add_argument('--bucket', type=str, default='', help='gsutil bucket')
parser.add_argument('--cache-images', action='store_true', help='cache images for faster training')
parser.add_argument('--weights', type=str, default='weights/ultralytics68.pt', help='initial weights')
parser.add_argument('--arc', type=str, default='default', help='yolo architecture') # defaultpw, uCE, uBCE
parser.add_argument('--arc', type=str, default='default', help='yolo architecture') # default, uCE, uBCE
parser.add_argument('--name', default='', help='renames results.txt to results_name.txt if supplied')
parser.add_argument('--device', default='', help='device id (i.e. 0 or 0,1 or cpu)')
parser.add_argument('--adam', action='store_true', help='use adam optimizer')
Expand Down

0 comments on commit 5d73b19

Please sign in to comment.