ultralytics 8.0.49 task, exports and metadata updates (#1197)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Mehran Ghandehari <mehran.maps@gmail.com>
Co-authored-by: Paul Guerrie <97041392+paulguerrie@users.noreply.github.com>
This commit is contained in:
Glenn Jocher 2023-03-01 21:16:09 -08:00 committed by GitHub
parent 74e4c94806
commit 3861e6c82a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 111 additions and 101 deletions

View file

@ -257,7 +257,7 @@ class ClassificationModel(BaseModel):
cfg=None,
model=None,
ch=3,
nc=1000,
nc=None,
cutoff=10,
verbose=True): # yaml, model, channels, number of classes, cutoff index, verbose flag
super().__init__()
@ -286,6 +286,8 @@ class ClassificationModel(BaseModel):
if nc and nc != self.yaml['nc']:
LOGGER.info(f"Overriding model.yaml nc={self.yaml['nc']} with nc={nc}")
self.yaml['nc'] = nc # override yaml value
elif not nc and not self.yaml.get('nc', None):
raise ValueError('nc not specified. Must specify nc in model.yaml or function arguments.')
self.model, self.save = parse_model(deepcopy(self.yaml), ch=ch, verbose=verbose) # model, savelist
self.stride = torch.Tensor([1]) # no stride constraints
self.names = {i: f'{i}' for i in range(self.yaml['nc'])} # default names dict