mindspore_hub
MindSpore Hub is a pre-trained model application tool of the MindSpore ecosystem, serving as a channel for model developers and application developers.
- mindspore_hub.hub_list(version=None, force_reload=False)[source]
List all assets supported by MindSpore Hub.
- Parameters
- Returns
list, a list of assets supported by MindSpore Hub.
Examples
>>> import mindspore_hub as ms_hub >>> hub_list = ms_hub.hub_list() >>> hub_list[:5] >>> ['3dcnn_brast2017', '3ddensenet_iseg2017', 'adnet_vot2013vot2014', 'advancedeast_icpr2018', 'aecrnet_reside']
- mindspore_hub.load(name, *args, source='gitee', pretrained=True, force_reload=False, **kwargs)[source]
Load network with the given name. After loading, it can be used for inference verification, migration learning, etc. If source is local, it will load the local model, if the model is not exist in local, it will auto-download. If pre_trained is True, the model will load the local ckpt file, if the ckpt file is not exist in local, it will auto-download and load the downloaded ckpt file.
- Parameters
name (str) – Uid or url of the network or local path.
args (tuple) – Arguments for network initialization.
source (str) – Whether to parse name as gitee model URI, github model URI or local resource. Default: gitee.
pretrained (bool) – Whether to load the pretrained model. Default: True.
force_reload (bool) – Whether to reload the network and the ckpt file from url. Default: False.
kwargs (dict) – Keyword arguments for network initialization.
- Returns
Cell, a network.
Examples
>>> import mindspore_hub >>> net = mindspore_hub.load('mindspore/1.3/alexnet_cifar10', 10, pretrained=True) >>> # For details about how to call the parameters of the network, >>> # please refer to the "Usage" in the md file of the network. >>> # >>> # 1. To find the corresponding md file, there are two methods: >>> # >>> # 1.1. Find the corresponding md file from the local hub source code. >>> # 1.1.1. Use 'git clone' command to copy the hub repository from >>> # Mindspore/hub<https://gitee.com/mindspore/hub.git>. Assume that the hub repository is cloned to <D:\hub\>. >>> # 1.1.2. The preceding address is <D:\hub\mshub_res\assets\mindspore\1.3\alexnet_cifar10.md>. >>> # >>> # 1.2. Find the corresponding md file from the website. >>> # 1.2.1. The prefix is fixed: <https://gitee.com/mindspore/hub/tree/master/mshub_res/assets/> >>> # + <address where you want to load the md file>. >>> # 1.2.2. The preceding address is >>> # <https://gitee.com/mindspore/hub/tree/master/mshub_res/assets/ >>> # mindspore/1.3/alexnet_cifar10.md>. >>> # >>> # 2. Want to find more information about this network? >>> # 2.1. Go to the corresponding website to learn more. >>> # 2.2. To obtain the corresponding website, perform the following steps: >>> # 2.2.1. After you have found the md file, there is a repo-link in the md file that allows >>> # you to directly access the web page of the corresponding network. >>> # 2.2.2. The web page corresponding to the preceding code is >>> # <https://gitee.com/mindspore/models/tree/r1.3/official/cv/alexnet>. >>> # >>> # 2.3. The web page of operation 2.2 contains a "mindspore_hub_conf.py", >>> # which is invoked by the load function. Therefore, to call more parameters, >>> # or if you want to DIY interfaces to be called, you can modify this file. >>> # It is recommended that you back up the mindspore_hub_conf.py file. >>> # 2.4. In addition to the function of mindspore_hub_conf.py, you can also call files in the src files of the >>> # corresponding web page. More Alexnet network information can be obtained from here.