mindspore-lab / mindcv

A toolbox of vision models and algorithms based on MindSpore
https://mindspore-lab.github.io/mindcv/
Apache License 2.0
231 stars 140 forks source link

resnet50 val_while_train 报错 #723

Closed AspartameJ closed 1 year ago

AspartameJ commented 1 year ago

If this is your first time, please read our contributor guidelines: https://github.com/mindspore-lab/mindcv/blob/main/CONTRIBUTING.md

Describe the bug/ 问题描述 (Mandatory / 必填) A clear and concise description of what the bug is.

在openi上使用train.py脚本在cifar10上训练resnet50的时候,启用--val_while_train True参数报错,报错提示没有val这个usage。

To Reproduce / 重现步骤 (Mandatory / 必填) Steps to reproduce the behavior:

  1. git clone https://github.com/mindspore-lab/mindcv.git
  2. 进入mindcv目录
  3. pip install -e .
  4. 下载cifar10数据集到cifar-10-batches-bin
  5. python train.py --model resnet50 --dataset cifar10 --data_dir ./cifar-10-batches-bin --batch_size 128 --val_while_train True
  6. See error

Expected behavior / 预期结果 (Mandatory / 必填) A clear and concise description of what you expected to happen.

(MindSpore) [ma-user mindcv]$python train.py --model resnet50 --dataset cifar10 --data_dir ./cifar-10-batches-bin  --batch_size 128 --val_while_train True
Traceback (most recent call last):
  File "train.py", line 337, in <module>
    train(args)
  File "train.py", line 124, in train
    download=args.dataset_download,
  File "/home/ma-user/work/mindcv/mindcv/data/dataset_factory.py", line 152, in create_dataset
    **mindspore_kwargs,
  File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.7/site-packages/mindspore/dataset/engine/validators.py", line 351, in new_method
    check_valid_str(usage, ["train", "test", "all"], "usage")
  File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.7/site-packages/mindspore/dataset/core/validator_helpers.py", line 405, in check_valid_str
    raise ValueError("Input {0} is not within the valid set of {1}.".format(arg_name, str(valid_strings)))
ValueError: Input usage is not within the valid set of ['train', 'test', 'all'].

Screenshots/ 日志 / 截图 (Mandatory / 必填) If applicable, add screenshots to help explain your problem. image

Additional context / 备注 (Optional / 选填) Add any other context about the problem here.

geniuspatrick commented 1 year ago

cifar10 only have 2 subset train and test. You need to pass --val_split=test to train.py