change name to create_dataset_cifar10

This commit is contained in:
wukesong 2020-07-13 11:26:56 +08:00
parent d0dd892884
commit 1ad056a0c9
3 changed files with 7 additions and 7 deletions

View File

@ -20,7 +20,7 @@ python eval.py --data_path /YourDataPath --ckpt_path Your.ckpt
import argparse
from src.config import alexnet_cfg as cfg
from src.dataset import create_dataset_mnist
from src.dataset import create_dataset_cifar10
from src.alexnet import AlexNet
import mindspore.nn as nn
from mindspore import context
@ -50,8 +50,8 @@ if __name__ == "__main__":
print("============== Starting Testing ==============")
param_dict = load_checkpoint(args.ckpt_path)
load_param_into_net(network, param_dict)
ds_eval = create_dataset_mnist(args.data_path,
cfg.batch_size,
status="test")
ds_eval = create_dataset_cifar10(args.data_path,
cfg.batch_size,
status="test")
acc = model.eval(ds_eval, dataset_sink_mode=args.dataset_sink_mode)
print("============== {} ==============".format(acc))

View File

@ -23,7 +23,7 @@ from mindspore.common import dtype as mstype
from .config import alexnet_cfg as cfg
def create_dataset_mnist(data_path, batch_size=32, repeat_size=1, status="train"):
def create_dataset_cifar10(data_path, batch_size=32, repeat_size=1, status="train"):
"""
create dataset for train or test
"""

View File

@ -20,7 +20,7 @@ python train.py --data_path /YourDataPath
import argparse
from src.config import alexnet_cfg as cfg
from src.dataset import create_dataset_mnist
from src.dataset import create_dataset_cifar10
from src.generator_lr import get_lr
from src.alexnet import AlexNet
import mindspore.nn as nn
@ -43,7 +43,7 @@ if __name__ == "__main__":
context.set_context(mode=context.GRAPH_MODE, device_target=args.device_target)
ds_train = create_dataset_mnist(args.data_path, cfg.batch_size, cfg.epoch_size)
ds_train = create_dataset_cifar10(args.data_path, cfg.batch_size, cfg.epoch_size)
network = AlexNet(cfg.num_classes)
loss = nn.SoftmaxCrossEntropyWithLogits(is_grad=False, sparse=True, reduction="mean")
lr = Tensor(get_lr(0, cfg.learning_rate, cfg.epoch_size, ds_train.get_dataset_size()))