Input channel yaml['ch'] addition (#1741)

This commit is contained in:
Glenn Jocher authored and GitHub committed 2020-12-19 10:54:01 -08:00
1 parent ab0db8d104
commit 394d1c89f3
2 files changed
+4 -3

No files matched your search

+3 -2
View File
@@ -1,10 +1,10 @@
import argparse
import logging
import math
import sys
from copy import deepcopy
from pathlib import Path
import math
import torch
import torch.nn as nn
@@ -78,10 +78,11 @@ class Model(nn.Module):
self.yaml = yaml.load(f, Loader=yaml.FullLoader) # model dict
# Define model
ch = self.yaml['ch'] = self.yaml.get('ch', ch) # input channels
if nc and nc != self.yaml['nc']:
logger.info('Overriding model.yaml nc=%g with nc=%g' % (self.yaml['nc'], nc))
self.yaml['nc'] = nc # override yaml value
self.model, self.save = parse_model(deepcopy(self.yaml), ch=[ch]) # model, savelist, ch_out
self.model, self.save = parse_model(deepcopy(self.yaml), ch=[ch]) # model, savelist
self.names = [str(i) for i in range(self.yaml['nc'])] # default names
# print([x.shape for x in self.forward(torch.zeros(1, ch, 64, 64))])