Rename img_size to imgsz (#86)

This commit is contained in:
Glenn Jocher
2022-12-24 00:39:09 +01:00
committed by GitHub
parent ae2443c210
commit 6432afc5f9
25 changed files with 98 additions and 98 deletions

View File

@ -55,11 +55,11 @@ class ClassificationPredictor(BasePredictor):
@hydra.main(version_base=None, config_path=DEFAULT_CONFIG.parent, config_name=DEFAULT_CONFIG.name)
def predict(cfg):
cfg.model = cfg.model or "squeezenet1_0"
sz = cfg.img_size
sz = cfg.imgsz
if type(sz) != int: # recieved listConfig
cfg.img_size = [sz[0], sz[0]] if len(cfg.img_size) == 1 else [sz[0], sz[1]] # expand
cfg.imgsz = [sz[0], sz[0]] if len(cfg.imgsz) == 1 else [sz[0], sz[1]] # expand
else:
cfg.img_size = [sz, sz]
cfg.imgsz = [sz, sz]
predictor = ClassificationPredictor(cfg)
predictor()

View File

@ -36,7 +36,7 @@ class ClassificationTrainer(BaseTrainer):
def get_dataloader(self, dataset_path, batch_size, rank=0, mode="train"):
return build_classification_dataloader(path=dataset_path,
imgsz=self.args.img_size,
imgsz=self.args.imgsz,
batch_size=batch_size,
rank=rank)
@ -70,7 +70,7 @@ def train(cfg):
if __name__ == "__main__":
"""
CLI usage:
python ultralytics/yolo/v8/classify/train.py model=resnet18 data=imagenette160 epochs=1 img_size=224
python ultralytics/yolo/v8/classify/train.py model=resnet18 data=imagenette160 epochs=1 imgsz=224
TODO:
Direct cli support, i.e, yolov8 classify_train args.epochs 10

View File

@ -28,7 +28,7 @@ class ClassificationValidator(BaseValidator):
return {"top1": top1, "top5": top5, "fitness": top5}
def get_dataloader(self, dataset_path, batch_size):
return build_classification_dataloader(path=dataset_path, imgsz=self.args.img_size, batch_size=batch_size)
return build_classification_dataloader(path=dataset_path, imgsz=self.args.imgsz, batch_size=batch_size)
@property
def metric_keys(self):