[to #42794773] rename pydataset to msdataset

This commit is contained in:
Yingda Chen
2022-06-25 08:36:48 +08:00
parent 0acbfe1663
commit c8e2e6de0e
16 changed files with 48 additions and 49 deletions

View File

@@ -1,7 +1,7 @@
modelscope.pydatasets package
modelscope.datasets package
=============================
.. automodule:: modelscope.pydatasets
.. automodule:: modelscope.datasets
:members:
:undoc-members:
:show-inheritance:
@@ -9,10 +9,10 @@ modelscope.pydatasets package
Submodules
----------
modelscope.pydatasets.py\_dataset module
modelscope.datasets.py\_dataset module
----------------------------------------
.. automodule:: modelscope.pydatasets.py_dataset
.. automodule:: modelscope.datasets.ms_dataset
:members:
:undoc-members:
:show-inheritance:

View File

@@ -16,7 +16,7 @@ Subpackages
modelscope.models
modelscope.pipelines
modelscope.preprocessors
modelscope.pydatasets
modelscope.datasets
modelscope.trainers
modelscope.utils

View File

@@ -3,7 +3,7 @@
## python环境配置
首先,参考[文档](https://docs.anaconda.com/anaconda/install/) 安装配置Anaconda环境
安装完成后执行如下命令为maas library创建对应的python环境。
安装完成后执行如下命令为modelscope library创建对应的python环境。
```shell
conda create -n modelscope python=3.6
conda activate modelscope
@@ -105,15 +105,15 @@ import cv2
import os.path as osp
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks
from modelscope.pydatasets import PyDataset
from modelscope.datasets import MsDataset
# 使用图像url构建PyDataset此处也可通过 input_location = '/dir/to/images' 来使用本地文件夹
# 使用图像url构建MsDataset此处也可通过 input_location = '/dir/to/images' 来使用本地文件夹
input_location = [
'http://pai-vision-data-hz.oss-cn-zhangjiakou.aliyuncs.com/data/test/maas/image_matting/test.png'
]
dataset = PyDataset.load(input_location, target='image')
dataset = MsDataset.load(input_location, target='image')
img_matting = pipeline(Tasks.image_matting, model='damo/image-matting-person')
# 输入为PyDataset时输出的结果为迭代器
# 输入为MsDataset时输出的结果为迭代器
result = img_matting(dataset)
cv2.imwrite('result.png', next(result)['output_png'])
print(f'Output written to {osp.abspath("result.png")}')