forked from mindspore-Ecosystem/mindspore
modify bug of Squeeze-residual and ssd export mindir failed
This commit is contained in:
parent
494639ad8e
commit
c39f15755a
|
@ -11,6 +11,7 @@ data_path: "/cache/data"
|
|||
output_path: "/cache/train"
|
||||
load_path: "/cache/checkpoint_path/"
|
||||
device_num: 1
|
||||
device_id: 0
|
||||
device_target: 'Ascend'
|
||||
checkpoint_path: './checkpoint/'
|
||||
checkpoint_file_path: 'suqeezenet_residual_cifar10-150_195.ckpt'
|
||||
|
|
|
@ -182,9 +182,6 @@ Create a container layer over the created image and start it
|
|||
bash scripts/docker_start.sh ssd:20.1.0 [DATA_DIR] [MODEL_DIR]
|
||||
```
|
||||
|
||||
如果要在modelarts上进行模型的训练,可以参考modelarts的官方指导文档(https://support.huaweicloud.com/modelarts/)
|
||||
开始进行模型的训练和推理,具体操作如下:
|
||||
|
||||
If you want to run in modelarts, please check the official documentation of [modelarts](https://support.huaweicloud.com/modelarts/), and you can start training and evaluation as follows:
|
||||
|
||||
```python
|
||||
|
|
|
@ -27,6 +27,13 @@ if config.device_target == "Ascend":
|
|||
context.set_context(device_id=config.device_id)
|
||||
|
||||
if __name__ == '__main__':
|
||||
if hasattr(config, 'num_ssd_boxes') and config.num_ssd_boxes == -1:
|
||||
num = 0
|
||||
h, w = config.img_shape
|
||||
for i in range(len(config.steps)):
|
||||
num += (h // config.steps[i]) * (w // config.steps[i]) * config.num_default[i]
|
||||
config.num_ssd_boxes = num
|
||||
|
||||
if config.model_name == "ssd300":
|
||||
net = SSD300(ssd_mobilenet_v2(), config, is_training=False)
|
||||
elif config.model_name == "ssd_vgg16":
|
||||
|
@ -38,13 +45,6 @@ if __name__ == '__main__':
|
|||
else:
|
||||
raise ValueError(f'config.model: {config.model_name} is not supported')
|
||||
|
||||
if hasattr(config, 'num_ssd_boxes') and config.num_ssd_boxes == -1:
|
||||
num = 0
|
||||
h, w = config.img_shape
|
||||
for i in range(len(config.steps)):
|
||||
num += (h // config.steps[i]) * (w // config.steps[i]) * config.num_default[i]
|
||||
config.num_ssd_boxes = num
|
||||
|
||||
net = SsdInferWithDecoder(net, Tensor(default_boxes), config)
|
||||
|
||||
param_dict = load_checkpoint(config.checkpoint_file_path)
|
||||
|
|
Loading…
Reference in New Issue