Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
367a51ae
M
mindspore
项目概览
magicwindyyd
/
mindspore
与 Fork 源项目一致
Fork自
MindSpore / mindspore
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindspore
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
367a51ae
编写于
6月 19, 2020
作者:
W
wukesong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add src dir
上级
b3f91a4f
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
30 addition
and
30 deletion
+30
-30
model_zoo/alexnet/README.md
model_zoo/alexnet/README.md
+7
-7
model_zoo/alexnet/eval.py
model_zoo/alexnet/eval.py
+3
-3
model_zoo/alexnet/src/__init__.py
model_zoo/alexnet/src/__init__.py
+0
-0
model_zoo/alexnet/src/alexnet.py
model_zoo/alexnet/src/alexnet.py
+0
-0
model_zoo/alexnet/src/config.py
model_zoo/alexnet/src/config.py
+0
-0
model_zoo/alexnet/src/dataset.py
model_zoo/alexnet/src/dataset.py
+0
-0
model_zoo/alexnet/src/generator_lr.py
model_zoo/alexnet/src/generator_lr.py
+0
-0
model_zoo/alexnet/train.py
model_zoo/alexnet/train.py
+4
-4
model_zoo/lenet/README.md
model_zoo/lenet/README.md
+6
-6
model_zoo/lenet/eval.py
model_zoo/lenet/eval.py
+5
-5
model_zoo/lenet/src/__init__.py
model_zoo/lenet/src/__init__.py
+0
-0
model_zoo/lenet/src/config.py
model_zoo/lenet/src/config.py
+0
-0
model_zoo/lenet/src/dataset.py
model_zoo/lenet/src/dataset.py
+0
-0
model_zoo/lenet/src/lenet.py
model_zoo/lenet/src/lenet.py
+0
-0
model_zoo/lenet/train.py
model_zoo/lenet/train.py
+5
-5
未找到文件。
model_zoo/alexnet/README.md
浏览文件 @
367a51ae
...
...
@@ -2,7 +2,7 @@
## Description
Training AlexNet with
CIFAR-10
dataset in MindSpore.
Training AlexNet with dataset in MindSpore.
This is the simple tutorial for training AlexNet in MindSpore.
...
...
@@ -10,19 +10,19 @@ This is the simple tutorial for training AlexNet in MindSpore.
-
Install
[
MindSpore
](
https://www.mindspore.cn/install/en
)
.
-
Download the
CIFAR-10
dataset, the directory structure is as follows:
-
Download the dataset, the directory structure is as follows:
```
├─
cifar-
10-batches-bin
├─10-batches-bin
│
└─
cifar-
10-verify-bin
└─10-verify-bin
```
## Running the example
```
python
# train AlexNet, hyperparameter setting in config.py
python
train
.
py
--
data_path
cifar
-
10
-
batches
-
bin
python
train
.
py
--
data_path
10
-
batches
-
bin
```
You will get the loss value of each step as following:
...
...
@@ -38,8 +38,8 @@ epoch: 1 step: 1538, loss is 1.0221305
Then, evaluate AlexNet according to network model
```
python
# evaluate AlexNet
, 1 epoch training accuracy is up to 51.1%; 10 epoch training accuracy is up to 81.2%
python
eval
.
py
--
data_path
cifar
-
10
-
verify
-
bin
--
ckpt_path
checkpoint_alexnet
-
1_1562.
ckpt
# evaluate AlexNet
python
eval
.
py
--
data_path
10
-
verify
-
bin
--
ckpt_path
checkpoint_alexnet
-
1_1562.
ckpt
```
## Note
...
...
model_zoo/alexnet/eval.py
浏览文件 @
367a51ae
...
...
@@ -19,9 +19,9 @@ python eval.py --data_path /YourDataPath --ckpt_path Your.ckpt
"""
import
argparse
from
config
import
alexnet_cfg
as
cfg
from
dataset
import
create_dataset_mnist
from
alexnet
import
AlexNet
from
src.
config
import
alexnet_cfg
as
cfg
from
src.
dataset
import
create_dataset_mnist
from
src.
alexnet
import
AlexNet
import
mindspore.nn
as
nn
from
mindspore
import
context
from
mindspore.train.serialization
import
load_checkpoint
,
load_param_into_net
...
...
model_zoo/alexnet/src/__init__.py
0 → 100644
浏览文件 @
367a51ae
model_zoo/alexnet/alexnet.py
→
model_zoo/alexnet/
src/
alexnet.py
浏览文件 @
367a51ae
文件已移动
model_zoo/alexnet/config.py
→
model_zoo/alexnet/
src/
config.py
浏览文件 @
367a51ae
文件已移动
model_zoo/alexnet/dataset.py
→
model_zoo/alexnet/
src/
dataset.py
浏览文件 @
367a51ae
文件已移动
model_zoo/alexnet/generator_lr.py
→
model_zoo/alexnet/
src/
generator_lr.py
浏览文件 @
367a51ae
文件已移动
model_zoo/alexnet/train.py
浏览文件 @
367a51ae
...
...
@@ -19,10 +19,10 @@ python train.py --data_path /YourDataPath
"""
import
argparse
from
config
import
alexnet_cfg
as
cfg
from
dataset
import
create_dataset_mnist
from
generator_lr
import
get_lr
from
alexnet
import
AlexNet
from
src.
config
import
alexnet_cfg
as
cfg
from
src.
dataset
import
create_dataset_mnist
from
src.
generator_lr
import
get_lr
from
src.
alexnet
import
AlexNet
import
mindspore.nn
as
nn
from
mindspore
import
context
from
mindspore
import
Tensor
...
...
model_zoo/lenet/README.md
浏览文件 @
367a51ae
...
...
@@ -2,7 +2,7 @@
## Description
Training LeNet with
MNIST
dataset in MindSpore.
Training LeNet with dataset in MindSpore.
This is the simple and basic tutorial for constructing a network in MindSpore.
...
...
@@ -10,10 +10,10 @@ This is the simple and basic tutorial for constructing a network in MindSpore.
-
Install
[
MindSpore
](
https://www.mindspore.cn/install/en
)
.
-
Download the
MNIST
dataset, the directory structure is as follows:
-
Download the dataset, the directory structure is as follows:
```
└─
MNIST_
Data
└─Data
├─test
│ t10k-images.idx3-ubyte
│ t10k-labels.idx1-ubyte
...
...
@@ -27,7 +27,7 @@ This is the simple and basic tutorial for constructing a network in MindSpore.
```
python
# train LeNet, hyperparameter setting in config.py
python
train
.
py
--
data_path
MNIST_
Data
python
train
.
py
--
data_path
Data
```
You will get the loss value of each step as following:
...
...
@@ -43,8 +43,8 @@ epoch: 1 step: 1741, loss is 0.05018193
Then, evaluate LeNet according to network model
```
python
# evaluate LeNet
, after 1 epoch training, the accuracy is up to 96.5%
python
eval
.
py
--
data_path
MNIST_
Data
--
ckpt_path
checkpoint_lenet
-
1_1875.
ckpt
# evaluate LeNet
python
eval
.
py
--
data_path
Data
--
ckpt_path
checkpoint_lenet
-
1_1875.
ckpt
```
## Note
...
...
model_zoo/lenet/eval.py
浏览文件 @
367a51ae
...
...
@@ -20,9 +20,9 @@ python eval.py --data_path /YourDataPath --ckpt_path Your.ckpt
import
os
import
argparse
from
dataset
import
create_dataset
from
config
import
mnist_cfg
as
cfg
from
lenet
import
LeNet5
from
src.
dataset
import
create_dataset
from
src.
config
import
mnist_cfg
as
cfg
from
src.
lenet
import
LeNet5
import
mindspore.nn
as
nn
from
mindspore
import
context
from
mindspore.train.serialization
import
load_checkpoint
,
load_param_into_net
...
...
@@ -32,10 +32,10 @@ from mindspore.nn.metrics import Accuracy
if
__name__
==
"__main__"
:
parser
=
argparse
.
ArgumentParser
(
description
=
'MindSpore
MNIST
Example'
)
parser
=
argparse
.
ArgumentParser
(
description
=
'MindSpore
Lenet
Example'
)
parser
.
add_argument
(
'--device_target'
,
type
=
str
,
default
=
"Ascend"
,
choices
=
[
'Ascend'
,
'GPU'
,
'CPU'
],
help
=
'device where the code will be implemented (default: Ascend)'
)
parser
.
add_argument
(
'--data_path'
,
type
=
str
,
default
=
"./
MNIST_
Data"
,
parser
.
add_argument
(
'--data_path'
,
type
=
str
,
default
=
"./Data"
,
help
=
'path where the dataset is saved'
)
parser
.
add_argument
(
'--ckpt_path'
,
type
=
str
,
default
=
""
,
help
=
'if mode is test, must provide
\
path where the trained ckpt file'
)
...
...
model_zoo/lenet/src/__init__.py
0 → 100644
浏览文件 @
367a51ae
model_zoo/lenet/config.py
→
model_zoo/lenet/
src/
config.py
浏览文件 @
367a51ae
文件已移动
model_zoo/lenet/dataset.py
→
model_zoo/lenet/
src/
dataset.py
浏览文件 @
367a51ae
文件已移动
model_zoo/lenet/lenet.py
→
model_zoo/lenet/
src/
lenet.py
浏览文件 @
367a51ae
文件已移动
model_zoo/lenet/train.py
浏览文件 @
367a51ae
...
...
@@ -20,9 +20,9 @@ python train.py --data_path /YourDataPath
import
os
import
argparse
from
config
import
mnist_cfg
as
cfg
from
dataset
import
create_dataset
from
lenet
import
LeNet5
from
src.
config
import
mnist_cfg
as
cfg
from
src.
dataset
import
create_dataset
from
src.
lenet
import
LeNet5
import
mindspore.nn
as
nn
from
mindspore
import
context
from
mindspore.train.callback
import
ModelCheckpoint
,
CheckpointConfig
,
LossMonitor
,
TimeMonitor
...
...
@@ -31,10 +31,10 @@ from mindspore.nn.metrics import Accuracy
if
__name__
==
"__main__"
:
parser
=
argparse
.
ArgumentParser
(
description
=
'MindSpore
MNIST
Example'
)
parser
=
argparse
.
ArgumentParser
(
description
=
'MindSpore
Lenet
Example'
)
parser
.
add_argument
(
'--device_target'
,
type
=
str
,
default
=
"Ascend"
,
choices
=
[
'Ascend'
,
'GPU'
,
'CPU'
],
help
=
'device where the code will be implemented (default: Ascend)'
)
parser
.
add_argument
(
'--data_path'
,
type
=
str
,
default
=
"./
MNIST_
Data"
,
parser
.
add_argument
(
'--data_path'
,
type
=
str
,
default
=
"./Data"
,
help
=
'path where the dataset is saved'
)
parser
.
add_argument
(
'--dataset_sink_mode'
,
type
=
bool
,
default
=
True
,
help
=
'dataset_sink_mode is False or True'
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录