Merge branch 'master-github' into merge_master_github_0224

This commit is contained in:
wenmeng.zwm
2023-02-24 11:16:35 +08:00
151 changed files with 1642 additions and 157 deletions

View File

@@ -27,7 +27,7 @@ on:
- "tools/**"
- ".dev_scripts/**"
- "README.md"
- "README_zh-CN.md"
- "README_*.md"
- "NOTICE"
- ".github/workflows/lint.yaml"
- ".github/workflows/publish.yaml"

View File

@@ -20,11 +20,10 @@ jobs:
with:
python-version: '3.7'
- name: Install wheel
run: pip install wheel
run: pip install wheel && pip install -r requirements/framework.txt
- name: Build ModelScope
run: python setup.py sdist bdist_wheel
- name: Publish package to PyPI
run: |
echo "I got run"
#pip install twine
#twine upload package/dist/* --skip-existing -u __token__ -p ${{ secrets.PYPI_API_TOKEN }}
pip install twine
twine upload package/dist/* --skip-existing -u __token__ -p ${{ secrets.PYPI_API_TOKEN }}

256
README.md
View File

@@ -1,4 +1,10 @@
<p align="center">
<br>
<img src="https://modelscope.oss-cn-beijing.aliyuncs.com/modelscope.gif" width="400"/>
<br>
<p>
<div align="center">
[![PyPI](https://img.shields.io/pypi/v/modelscope)](https://pypi.org/project/modelscope/)
@@ -12,31 +18,263 @@
<!-- [![GitHub contributors](https://img.shields.io/github/contributors/modelscope/modelscope.svg)](https://GitHub.com/modelscope/modelscope/graphs/contributors/) -->
<!-- [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) -->
<h4 align="center">
<p>
<b>English</b> |
<a href="https://github.com/modelscope/modelscope/blob/master/README_zh.md">中文</a>
<p>
</h4>
</div>
# Introduction
[ModelScope]( https://www.modelscope.cn) is a “Model-as-a-Service” (MaaS) platform that seeks to bring together most advanced machine learning models from the AI community, and to streamline the process of leveraging AI models in real applications. The core ModelScope library enables developers to perform inference, training and evaluation, through rich layers of API designs that facilitate a unified experience across state-of-the-art models from different AI domains.
[ModelScope]( https://www.modelscope.cn) is built upon the notion of “Model-as-a-Service” (MaaS). It seeks to bring together most advanced machine learning models from the AI community, and streamlines the process of leveraging AI models in real-world applications. The core ModelScope library open-sourced in this repository provides the interfaces and implementations that allow developers to perform model inference, training and evaluation.
The Python library offers the layered-APIs necessary for model contributors to integrate models from CV, NLP, Speech, Multi-Modality, as well as Scientific-computation, into the ModelScope ecosystem. Implementations for all these different models are encapsulated within the library in a way that allows easy and unified access. With such integration, model inference, finetuning, and evaluations can be done with only a few lines of codes. In the meantime, flexibilities are provided so that different components in the model applications can be customized as well, where necessary.
Apart from harboring implementations of various models, ModelScope library also enables the necessary interactions with ModelScope backend services, particularly with the Model-Hub and Dataset-Hub. Such interactions facilitate management of various entities (models and datasets) to be performed seamlessly under-the-hood, including entity lookup, version control, cache management, and many others.
In particular, with rich layers of API-abstraction, the ModelScope library offers unified experience to explore state-of-the-art models spanning across domains such as CV, NLP, Speech, Multi-Modality, and Scientific-computation. Model contributors of different areas can integrate models into the ModelScope ecosystem through the layered-APIs, allowing easy and unified access to their models. Once integrated, model inference, fine-tuning, and evaluations can be done with only a few lines of codes. In the meantime, flexibilities are also provided so that different components in the model applications can be customized wherever necessary.
Apart from harboring implementations of a wide range of different models, ModelScope library also enables the necessary interactions with ModelScope backend services, particularly with the Model-Hub and Dataset-Hub. Such interactions facilitate management of various entities (models and datasets) to be performed seamlessly under-the-hood, including entity lookup, version control, cache management, and many others.
# Models and Online Accessibility
Hundreds of models are made publicly available on [ModelScope]( https://www.modelscope.cn) (600+ and counting), covering the latest development in areas such as NLP, CV, Audio, Multi-modality, and AI for Science, etc. Many of these models represent the SOTA in their specific fields, and made their open-sourced debut on ModelScope. Users can visit ModelScope([modelscope.cn](http://www.modelscope.cn)) and experience first-hand how these models perform via online experience, with just a few clicks. Immediate developer-experience is also possible through the ModelScope Notebook, which is backed by ready-to-use CPU/GPU development environment in the cloud - only one click away on [ModelScope](https://www.modelscope.cn).
<p align="center">
<br>
<img src="data/resource/inference.gif" width="1024"/>
<br>
<p>
Some representative examples include:
NLP:
* [nlp_gpt3_text-generation_2.7B](https://modelscope.cn/models/damo/nlp_gpt3_text-generation_2.7B)
* [ChatYuan-large](https://modelscope.cn/models/ClueAI/ChatYuan-large)
* [mengzi-t5-base](https://modelscope.cn/models/langboat/mengzi-t5-base)
* [nlp_csanmt_translation_en2zh](https://modelscope.cn/models/damo/nlp_csanmt_translation_en2zh)
* [nlp_raner_named-entity-recognition_chinese-base-news](https://modelscope.cn/models/damo/nlp_raner_named-entity-recognition_chinese-base-news)
* [nlp_structbert_word-segmentation_chinese-base](https://modelscope.cn/models/damo/nlp_structbert_word-segmentation_chinese-base)
* [Erlangshen-RoBERTa-330M-Sentiment](https://modelscope.cn/models/fengshenbang/Erlangshen-RoBERTa-330M-Sentiment)
* [nlp_convai_text2sql_pretrain_cn](https://modelscope.cn/models/damo/nlp_convai_text2sql_pretrain_cn)
Audio:
* [speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch](https://modelscope.cn/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch)
* [speech_sambert-hifigan_tts_zh-cn_16k](https://modelscope.cn/models/damo/speech_sambert-hifigan_tts_zh-cn_16k)
* [speech_charctc_kws_phone-xiaoyun](https://modelscope.cn/models/damo/speech_charctc_kws_phone-xiaoyun)
* [u2pp_conformer-asr-cn-16k-online](https://modelscope.cn/models/wenet/u2pp_conformer-asr-cn-16k-online)
* [speech_frcrn_ans_cirm_16k](https://modelscope.cn/models/damo/speech_frcrn_ans_cirm_16k)
* [speech_dfsmn_aec_psm_16k](https://modelscope.cn/models/damo/speech_dfsmn_aec_psm_16k)
CV:
* [cv_tinynas_object-detection_damoyolo](https://modelscope.cn/models/damo/cv_tinynas_object-detection_damoyolo)
* [cv_unet_person-image-cartoon_compound-models](https://modelscope.cn/models/damo/cv_unet_person-image-cartoon_compound-models)
* [cv_convnextTiny_ocr-recognition-general_damo](https://modelscope.cn/models/damo/cv_convnextTiny_ocr-recognition-general_damo)
* [cv_resnet18_human-detection](https://modelscope.cn/models/damo/cv_resnet18_human-detection)
* [cv_resnet50_face-detection_retinaface](https://modelscope.cn/models/damo/cv_resnet50_face-detection_retinaface)
* [cv_unet_image-matting](https://modelscope.cn/models/damo/cv_unet_image-matting)
* [cv_F3Net_product-segmentation](https://modelscope.cn/models/damo/cv_F3Net_product-segmentation)
* [cv_resnest101_general_recognition](https://modelscope.cn/models/damo/cv_resnest101_general_recognition)
Multi-Modal:
* [multi-modal_clip-vit-base-patch16_zh](https://modelscope.cn/models/damo/multi-modal_clip-vit-base-patch16_zh)
* [ofa_pretrain_base_zh](https://modelscope.cn/models/damo/ofa_pretrain_base_zh)
* [Taiyi-Stable-Diffusion-1B-Chinese-v0.1](https://modelscope.cn/models/fengshenbang/Taiyi-Stable-Diffusion-1B-Chinese-v0.1)
* [mplug_visual-question-answering_coco_large_en](https://modelscope.cn/models/damo/mplug_visual-question-answering_coco_large_en)
AI for Science:
* [uni-fold-monomer](https://modelscope.cn/models/DPTech/uni-fold-monomer/summary)
* [uni-fold-multimer](https://modelscope.cn/models/DPTech/uni-fold-multimer/summary)
# QuickTour
We provide unified interface for inference using `pipeline`, fine-tuning and evaluation using `Trainer` for different tasks.
For any given task with any type of input (image, text, audio, video...), inference pipeline can be implemented with only a few lines of code, which will automatically load the underlying model to get inference result, as is exemplified below:
```python
>>> from modelscope.pipelines import pipeline
>>> word_segmentation = pipeline('word-segmentation',model='damo/nlp_structbert_word-segmentation_chinese-base')
>>> word_segmentation('今天天气不错,适合出去游玩')
{'output': '今天 天气 不错 适合 出去 游玩'}
```
Given an image, portrait matting (aka. background-removal) can be accomplished with the following code snippet:
![image](data/resource/portrait_input.png)
```python
>>> import cv2
>>> from modelscope.pipelines import pipeline
>>> portrait_matting = pipeline('portrait-matting')
>>> result = portrait_matting('https://modelscope.oss-cn-beijing.aliyuncs.com/test/images/image_matting.png')
>>> cv2.imwrite('result.png', result['output_img'])
```
The output image with the background removed is:
![image](data/resource/portrait_output.png)
Fine-tuning and evaluation can also be done with a few more lines of code to set up training dataset and trainer, with the heavy-lifting work of training and evaluation a model encapsulated in the implementation of `traner.train()` and
`trainer.evaluate()` interfaces.
For example, the gpt3 base model (1.3B) can be fine-tuned with the chinese-poetry dataset, resulting in a model that can be used for chinese-poetry generation.
```python
>>> from modelscope.metainfo import Trainers
>>> from modelscope.msdatasets import MsDataset
>>> from modelscope.trainers import build_trainer
>>> train_dataset = MsDataset.load('chinese-poetry-collection', split='train'). remap_columns({'text1': 'src_txt'})
>>> eval_dataset = MsDataset.load('chinese-poetry-collection', split='test').remap_columns({'text1': 'src_txt'})
>>> max_epochs = 10
>>> tmp_dir = './gpt3_poetry'
>>> kwargs = dict(
model='damo/nlp_gpt3_text-generation_1.3B',
train_dataset=train_dataset,
eval_dataset=eval_dataset,
max_epochs=max_epochs,
work_dir=tmp_dir)
>>> trainer = build_trainer(name=Trainers.gpt3_trainer, default_args=kwargs)
>>> trainer.train()
```
# Why should I use ModelScope library
1. A unified and concise user interface is abstracted for different tasks and different models. Model inferences and training can be implemented by as few as 3 and 10 lines of code, respectively. It is convenient for users to explore models in different fields in the ModelScope community. All models integrated into ModelScope are ready to use, which makes it easy to get started with AI, in both educational and industrial settings.
2. ModelScope offers a model-centric development and application experience. It streamlines the support for model training, inference, export and deployment, and facilitates users to build their own MLOps based on the ModelScope ecosystem.
3. For the model inference and training process, a modular design is put in place, and a wealth of functional module implementations are provided, which is convenient for users to customize their own model inference, training and other processes.
4. For distributed model training, especially for large models, it provides rich training strategy support, including data parallel, model parallel, hybrid parallel and so on.
# Installation
Please refer to [installation](https://modelscope.cn/docs/%E7%8E%AF%E5%A2%83%E5%AE%89%E8%A3%85).
## Docker
# Get Started
ModelScope Library currently supports popular deep learning framework for model training and inference, including PyTorch, TensorFlow and ONNX. All releases are tested and run on Python 3.7+, Pytorch 1.8+, Tensorflow1.15 or Tensorflow2.0+.
You can refer to [quick_start](https://modelscope.cn/docs/%E5%BF%AB%E9%80%9F%E5%BC%80%E5%A7%8B) for quick start.
To allow out-of-box usage for all the models on ModelScope, official docker images are provided for all releases. Based on the docker image, developers can skip all environment installation and configuration and use it directly. Currently, the latest version of the CPU image and GPU image can be obtained from:
We also provide other documentations including:
CPU docker image
```shell
registry.cn-hangzhou.aliyuncs.com/modelscope-repo/modelscope:ubuntu20.04-py37-torch1.11.0-tf1.15.5-1.3.0
```
GPU docker image
```shell
registry.cn-hangzhou.aliyuncs.com/modelscope-repo/modelscope:ubuntu20.04-cuda11.3.0-py37-torch1.11.0-tf1.15.5-1.3.0
```
## Setup Local Python Environment
One can also set up local ModelScope environment using pip and conda. We suggest [anaconda](https://docs.anaconda.com/anaconda/install/) for creating local python environment:
```shell
conda create -n modelscope python=3.7
conda activate modelscope
```
PyTorch or TensorFlow can be installed separately according to each model's requirements.
* Install pytorch [doc](https://pytorch.org/get-started/locally/)
* Install tensorflow [doc](https://www.tensorflow.org/install/pip)
After installing the necessary machine-learning framework, you can install modelscope library as follows:
If you only want to play around with the modelscope framework, of trying out model/dataset download, you can install the core modelscope components:
```shell
pip install modelscope
```
If you want to use multi-modal models:
```shell
pip install modelscope[multi-modal]
```
If you want to use nlp models:
```shell
pip install modelscope[nlp] -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html
```
If you want to use cv models:
```shell
pip install modelscope[cv] -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html
```
If you want to use audio models:
```shell
pip install modelscope[audio] -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html
```
If you want to use science models:
```shell
pip install modelscope[science] -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html
```
`Notes`:
1. Currently, some audio-task models only support python3.7, tensorflow1.15.4 Linux environments. Most other models can be installed and used on Windows and Mac (x86).
2. Some models in the audio field use the third-party library SoundFile for wav file processing. On the Linux system, users need to manually install libsndfile of SoundFile([doc link](https://github.com/bastibe/python-soundfile#installation)). On Windows and MacOS, it will be installed automatically without user operation. For example, on Ubuntu, you can use following commands:
```shell
sudo apt-get update
sudo apt-get install libsndfile1
```
3. Some models in computer vision need mmcv-full, you can refer to mmcv [installation guide](https://github.com/open-mmlab/mmcv#installation), a minimal installation is as follows:
```shell
pip uninstall mmcv # if you have installed mmcv, uninstall it
pip install -U openmim
mim install mmcv-full
```
# Learn More
We provide additional documentations including:
* [More detailed Installation Guide](https://modelscope.cn/docs/%E7%8E%AF%E5%A2%83%E5%AE%89%E8%A3%85)
* [Introduction to tasks](https://modelscope.cn/docs/%E4%BB%BB%E5%8A%A1%E7%9A%84%E4%BB%8B%E7%BB%8D)
* [Use pipeline for model inference](https://modelscope.cn/docs/%E6%A8%A1%E5%9E%8B%E7%9A%84%E6%8E%A8%E7%90%86Pipeline)
* [Finetune example](https://modelscope.cn/docs/%E6%A8%A1%E5%9E%8B%E7%9A%84%E8%AE%AD%E7%BB%83Train)
* [Finetuning example](https://modelscope.cn/docs/%E6%A8%A1%E5%9E%8B%E7%9A%84%E8%AE%AD%E7%BB%83Train)
* [Preprocessing of data](https://modelscope.cn/docs/%E6%95%B0%E6%8D%AE%E7%9A%84%E9%A2%84%E5%A4%84%E7%90%86)
* [Evaluation metrics](https://modelscope.cn/docs/%E6%A8%A1%E5%9E%8B%E7%9A%84%E8%AF%84%E4%BC%B0)
* [Evaluation](https://modelscope.cn/docs/%E6%A8%A1%E5%9E%8B%E7%9A%84%E8%AF%84%E4%BC%B0)
* [Contribute your own model to ModelScope](https://modelscope.cn/docs/ModelScope%E6%A8%A1%E5%9E%8B%E6%8E%A5%E5%85%A5%E6%B5%81%E7%A8%8B%E6%A6%82%E8%A7%88)
# License

273
README_zh.md Normal file
View File

@@ -0,0 +1,273 @@
<p align="center">
<br>
<img src="https://modelscope.oss-cn-beijing.aliyuncs.com/modelscope.gif" width="400"/>
<br>
<p>
<div align="center">
[![PyPI](https://img.shields.io/pypi/v/modelscope)](https://pypi.org/project/modelscope/)
<!-- [![Documentation Status](https://readthedocs.org/projects/easy-cv/badge/?version=latest)](https://easy-cv.readthedocs.io/en/latest/) -->
[![license](https://img.shields.io/github/license/modelscope/modelscope.svg)](https://github.com/modelscope/modelscope/blob/master/LICENSE)
[![open issues](https://isitmaintained.com/badge/open/modelscope/modelscope.svg)](https://github.com/modelscope/modelscope/issues)
[![GitHub pull-requests](https://img.shields.io/github/issues-pr/modelscope/modelscope.svg)](https://GitHub.com/modelscope/modelscope/pull/)
[![GitHub latest commit](https://badgen.net/github/last-commit/modelscope/modelscope)](https://GitHub.com/modelscope/modelscope/commit/)
[![Leaderboard](https://img.shields.io/badge/ModelScope-Check%20Your%20Contribution-orange)](https://opensource.alibaba.com/contribution_leaderboard/details?projectValue=modelscope)
<!-- [![GitHub contributors](https://img.shields.io/github/contributors/modelscope/modelscope.svg)](https://GitHub.com/modelscope/modelscope/graphs/contributors/) -->
<!-- [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) -->
<h4 align="center">
<p>
<a href="https://github.com/modelscope/modelscope/blob/master/README.md">English</a> |
<b>中文</b>
<p>
</h4>
</div>
# 简介
[ModelScope]( https://www.modelscope.cn) 是一个“模型即服务”(MaaS)平台旨在汇集来自AI社区的最先进的机器学习模型并简化在实际应用中使用AI模型的流程。ModelScope库使开发人员能够通过丰富的API设计执行推理、训练和评估从而促进跨不同AI领域的最先进模型的统一体验。
ModelScope Library为模型贡献者提供了必要的分层API以便将来自 CV、NLP、语音、多模态以及科学计算的模型集成到ModelScope生态系统中。所有这些不同模型的实现都以一种简单统一访问的方式进行封装用户只需几行代码即可完成模型推理、微调和评估。同时灵活的模块化设计使得在必要时也可以自定义模型训练推理过程中的不同组件。
除了包含各种模型的实现之外ModelScope Library还支持与ModelScope后端服务进行必要的交互特别是与Model-Hub和Dataset-Hub的交互。这种交互促进了模型和数据集的管理在后台无缝执行包括模型数据集查询、版本控制、缓存管理等。
# 部分模型和在线体验
ModelScope开源了数百个(当前600+)模型涵盖自然语言处理、计算机视觉、语音、多模态、科学计算等其中包含数百个SOTA模型。用户可以进入ModelScope网站([modelscope.cn](http://www.modelscope.cn))的模型中心零门槛在线体验或者Notebook方式体验模型。
<p align="center">
<br>
<img src="data/resource/inference.gif" width="1024"/>
<br>
<p>
示例如下:
自然语言处理:
* [GPT-3预训练生成模型-中文-2.7B](https://modelscope.cn/models/damo/nlp_gpt3_text-generation_2.7B)
* [元语功能型对话大模型](https://modelscope.cn/models/ClueAI/ChatYuan-large)
* [孟子T5预训练生成模型-中文-base](https://modelscope.cn/models/langboat/mengzi-t5-base)
* [CSANMT连续语义增强机器翻译-英中-通用领域-large](https://modelscope.cn/models/damo/nlp_csanmt_translation_en2zh)
* [RaNER命名实体识别-中文-新闻领域-base](https://modelscope.cn/models/damo/nlp_raner_named-entity-recognition_chinese-base-news)
* [BAStructBERT分词-中文-新闻领域-base](https://modelscope.cn/models/damo/nlp_structbert_word-segmentation_chinese-base)
* [二郎神-RoBERTa-330M-情感分类](https://modelscope.cn/models/fengshenbang/Erlangshen-RoBERTa-330M-Sentiment)
* [SPACE-T表格问答预训练模型-中文-通用领域-base](https://modelscope.cn/models/damo/nlp_convai_text2sql_pretrain_cn)
语音:
* [Paraformer语音识别-中文-通用-16k-离线-large-pytorch](https://modelscope.cn/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch)
* [语音合成-中文-多情感领域-16k-多发音人](https://modelscope.cn/models/damo/speech_sambert-hifigan_tts_zh-cn_16k)
* [CTC语音唤醒-移动端-单麦-16k-小云小云](https://modelscope.cn/models/damo/speech_charctc_kws_phone-xiaoyun)
* [WeNet-U2pp_Conformer-语音识别-中文-16k-实时](https://modelscope.cn/models/wenet/u2pp_conformer-asr-cn-16k-online)
* [FRCRN语音降噪-单麦-16k](https://modelscope.cn/models/damo/speech_frcrn_ans_cirm_16k)
* [DFSMN回声消除-单麦单参考-16k](https://modelscope.cn/models/damo/speech_dfsmn_aec_psm_16k)
计算机视觉:
* [DAMOYOLO-高性能通用检测模型-S](https://modelscope.cn/models/damo/cv_tinynas_object-detection_damoyolo)
* [DCT-Net人像卡通化](https://modelscope.cn/models/damo/cv_unet_person-image-cartoon_compound-models)
* [读光-文字识别-行识别模型-中英-通用领域](https://modelscope.cn/models/damo/cv_convnextTiny_ocr-recognition-general_damo)
* [人体检测-通用-Base](https://modelscope.cn/models/damo/cv_resnet18_human-detection)
* [RetinaFace人脸检测关键点模型](https://modelscope.cn/models/damo/cv_resnet50_face-detection_retinaface)
* [BSHM人像抠图](https://modelscope.cn/models/damo/cv_unet_image-matting)
* [图像分割-商品展示图场景的商品分割-电商领域](https://modelscope.cn/models/damo/cv_F3Net_product-segmentation)
* [万物识别-中文-通用领域](https://modelscope.cn/models/damo/cv_resnest101_general_recognition)
多模态:
* [CLIP模型-中文-通用领域-base](https://modelscope.cn/models/damo/multi-modal_clip-vit-base-patch16_zh)
* [OFA预训练模型-中文-通用领域-base](https://modelscope.cn/models/damo/ofa_pretrain_base_zh)
* [太乙-Stable-Diffusion-1B-中文-v0.1](https://modelscope.cn/models/fengshenbang/Taiyi-Stable-Diffusion-1B-Chinese-v0.1)
* [mPLUG视觉问答模型-英文-large](https://modelscope.cn/models/damo/mplug_visual-question-answering_coco_large_en)
科学计算:
* [Uni-Fold-Monomer 开源的蛋白质单体结构预测模型](https://modelscope.cn/models/DPTech/uni-fold-monomer/summary)
* [Uni-Fold-Multimer 开源的蛋白质复合物结构预测模型](https://modelscope.cn/models/DPTech/uni-fold-multimer/summary)
# 快速上手
我们针对不同任务提供了统一的使用接口, 使用`pipeline`进行模型推理、使用`Trainer`进行微调和评估。
对于任意类型输入(图像、文本、音频、视频...的任何任务只需3行代码即可加载模型并获得推理结果如下所示
```python
>>> from modelscope.pipelines import pipeline
>>> word_segmentation = pipeline('word-segmentation',model='damo/nlp_structbert_word-segmentation_chinese-base')
>>> word_segmentation('今天天气不错,适合出去游玩')
{'output': '今天 天气 不错 适合 出去 游玩'}
```
给定一张图片,你可以使用如下代码进行人像抠图.
![image](data/resource/portrait_input.png)
```python
>>> import cv2
>>> from modelscope.pipelines import pipeline
>>> portrait_matting = pipeline('portrait-matting')
>>> result = portrait_matting('https://modelscope.oss-cn-beijing.aliyuncs.com/test/images/image_matting.png')
>>> cv2.imwrite('result.png', result['output_img'])
```
输出图像如下
![image](data/resource/portrait_output.png)
对于微调和评估模型, 你需要通过十多行代码构建dataset和trainer调用`trainer.train()``trainer.evaluate()`即可。
例如我们利用gpt3 1.3B的模型加载是诗歌数据集进行finetune可以完成古诗生成模型的训练。
```python
>>> from modelscope.metainfo import Trainers
>>> from modelscope.msdatasets import MsDataset
>>> from modelscope.trainers import build_trainer
>>> train_dataset = MsDataset.load('chinese-poetry-collection', split='train'). remap_columns({'text1': 'src_txt'})
>>> eval_dataset = MsDataset.load('chinese-poetry-collection', split='test').remap_columns({'text1': 'src_txt'})
>>> max_epochs = 10
>>> tmp_dir = './gpt3_poetry'
>>> kwargs = dict(
model='damo/nlp_gpt3_text-generation_1.3B',
train_dataset=train_dataset,
eval_dataset=eval_dataset,
max_epochs=max_epochs,
work_dir=tmp_dir)
>>> trainer = build_trainer(name=Trainers.gpt3_trainer, default_args=kwargs)
>>> trainer.train()
```
# 为什么要用ModelScope library
1. 针对不同任务、不同模型抽象了统一简洁的用户接口3行代码完成推理10行代码完成模型训练方便用户使用ModelScope社区中多个领域的不同模型开箱即用便于AI入门和教学。
2. 构造以模型为中心的开发应用体验支持模型训练、推理、导出部署方便用户基于ModelScope Library构建自己的MLOps.
3. 针对模型推理、训练流程,进行了模块化的设计,并提供了丰富的功能模块实现,方便用户定制化开发来自定义自己的推理、训练等过程。
4. 针对分布式模型训练,尤其是大模型,提供了丰富的训练策略支持,包括数据并行、模型并行、混合并行等。
# 安装
## 镜像
ModelScope Library目前支持tensorflowpytorch深度学习框架进行模型训练、推理 在Python 3.7+, Pytorch 1.8+, Tensorflow1.15/Tensorflow2.0+测试可运行。
为了让大家能直接用上ModelScope平台上的所有模型无需配置环境ModelScope提供了官方镜像方便有需要的开发者获取。地址如下
CPU镜像
```shell
registry.cn-hangzhou.aliyuncs.com/modelscope-repo/modelscope:ubuntu20.04-py37-torch1.11.0-tf1.15.5-1.3.0
```
GPU镜像
```shell
registry.cn-hangzhou.aliyuncs.com/modelscope-repo/modelscope:ubuntu20.04-cuda11.3.0-py37-torch1.11.0-tf1.15.5-1.3.0
```
## 搭建本地Python环境
你也可以使用pip和conda搭建本地python环境我们推荐使用[Anaconda](https://docs.anaconda.com/anaconda/install/)安装完成后执行如下命令为modelscope library创建对应的python环境
```shell
conda create -n modelscope python=3.7
conda activate modelscope
```
接下来根据所需使用的模型依赖安装底层计算框架
* 安装Pytorch [文档链接](https://pytorch.org/get-started/locally/)
* 安装tensorflow [文档链接](https://www.tensorflow.org/install/pip)
安装完前置依赖你可以按照如下方式安装ModelScope Library。
ModelScope Libarary由核心框架以及不同领域模型的对接组件组成。如果只需要ModelScope模型和数据集访问等基础能力可以只安装ModelScope的核心框架
```shell
pip install modelscope
```
如仅需体验多模态领域的模型,可执行如下命令安装领域依赖:
```shell
pip install modelscope[multi-modal]
```
如仅需体验NLP领域模型可执行如下命令安装领域依赖因部分依赖由ModelScope独立host所以需要使用"-f"参数):
```shell
pip install modelscope[nlp] -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html
```
If you want to use cv models:
```shell
pip install modelscope[cv] -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html
```
如仅需体验语音领域模型可执行如下命令安装领域依赖因部分依赖由ModelScope独立host所以需要使用"-f"参数):
```shell
pip install modelscope[audio] -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html
```
`注意`当前大部分语音模型需要在Linux环境上使用并且推荐使用python3.7 + tensorflow 1.x的组合。
如仅需体验科学计算领域模型可执行如下命令安装领域依赖因部分依赖由ModelScope独立host所以需要使用"-f"参数):
```shell
pip install modelscope[science] -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html
```
`注`:
1. 目前部分语音相关的模型仅支持 python3.7,tensorflow1.15.4的Linux环境使用。 其他绝大部分模型可以在windows、macx86上安装使用。.
2. 语音领域中一部分模型使用了三方库SoundFile进行wav文件处理在Linux系统上用户需要手动安装SoundFile的底层依赖库libsndfile在Windows和MacOS上会自动安装不需要用户操作。详细信息可参考[SoundFile 官网](https://github.com/bastibe/python-soundfile#installation)。以Ubuntu系统为例用户需要执行如下命令:
```shell
sudo apt-get update
sudo apt-get install libsndfile1
```
3. CV领域的少数模型需要安装mmcv-full 如果运行过程中提示缺少mmcv请参考mmcv[安装手册](https://github.com/open-mmlab/mmcv#installation)进行安装。 这里提供一个最简版的mmcv-full安装步骤但是要达到最优的mmcv-full的安装效果包括对于cuda版本的兼容请根据自己的实际机器环境以mmcv官方安装手册为准。
```shell
pip uninstall mmcv # if you have installed mmcv, uninstall it
pip install -U openmim
mim install mmcv-full
```
# 更多教程
除了上述内容,我们还提供如下信息:
* [更加详细的安装文档](https://modelscope.cn/docs/%E7%8E%AF%E5%A2%83%E5%AE%89%E8%A3%85)
* [任务的介绍](https://modelscope.cn/docs/%E4%BB%BB%E5%8A%A1%E7%9A%84%E4%BB%8B%E7%BB%8D)
* [模型推理](https://modelscope.cn/docs/%E6%A8%A1%E5%9E%8B%E7%9A%84%E6%8E%A8%E7%90%86Pipeline)
* [模型微调](https://modelscope.cn/docs/%E6%A8%A1%E5%9E%8B%E7%9A%84%E8%AE%AD%E7%BB%83Train)
* [数据预处理](https://modelscope.cn/docs/%E6%95%B0%E6%8D%AE%E7%9A%84%E9%A2%84%E5%A4%84%E7%90%86)
* [模型评估](https://modelscope.cn/docs/%E6%A8%A1%E5%9E%8B%E7%9A%84%E8%AF%84%E4%BC%B0)
* [贡献模型到ModelScope](https://modelscope.cn/docs/ModelScope%E6%A8%A1%E5%9E%8B%E6%8E%A5%E5%85%A5%E6%B5%81%E7%A8%8B%E6%A6%82%E8%A7%88)
# License
本项目使用[Apache License (Version 2.0)](https://github.com/modelscope/modelscope/blob/master/LICENSE).

BIN
data/resource/inference.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:af83a94899a6d23339c3ecc5c4c58c57c835af57b531a2f4c50461184f820141
size 603621

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:28f6d784547c295711f1a8b7c83cf7e8d19b6361de56e9a69667fc9c9b8a429a
size 661491

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:301b684c4f44e999654ce279ca82f2571fe902f1e1ada70c0b852c04c2dc667b
size 102532

View File

@@ -395,8 +395,8 @@ class HubApi:
Args:
model_id (str): The model id
cutoff_timestamp (int): Tags created before the cutoff will be included.
The timestamp is represented by the seconds elasped from the epoch time.
use_cookies (Union[bool, CookieJar], optional): If is cookieJar, we will use this cookie, if True, will
The timestamp is represented by the seconds elapsed from the epoch time.
use_cookies (Union[bool, CookieJar], optional): If is cookieJar, we will use this cookie, if True,
will load cookie from local. Defaults to False.
Returns:
@@ -472,7 +472,7 @@ class HubApi:
Args:
model_id (str): The model id
use_cookies (Union[bool, CookieJar], optional): If is cookieJar, we will use this cookie, if True, will
use_cookies (Union[bool, CookieJar], optional): If is cookieJar, we will use this cookie, if True,
will load cookie from local. Defaults to False.
Returns:

View File

@@ -75,7 +75,7 @@ def check_local_model_is_latest(
continue
else:
logger.info(
'Model is updated from modelscope hub, you can verify from http://www.modelscope.cn.'
'Model is updated from modelscope hub, you can verify from https://www.modelscope.cn.'
)
break
else:
@@ -86,7 +86,7 @@ def check_local_model_is_latest(
continue
else:
logger.info(
'Model is updated from modelscope hub, you can verify from http://www.modelscope.cn.'
'Model is updated from modelscope hub, you can verify from https://www.modelscope.cn.'
)
break
except: # noqa: E722

View File

@@ -185,7 +185,7 @@ class DeleteServiceParameters(AttrsToQueryString):
class ServiceDeployer(object):
"""Faciliate model deployment on to supported service provider(s).
"""Facilitate model deployment on to supported service provider(s).
"""
def __init__(self, endpoint=None):

View File

@@ -49,7 +49,7 @@ def model_file_download(
Can be any of a branch, tag or commit hash.
cache_dir (str, Path, optional): Path to the folder where cached files are stored.
user_agent (dict, str, optional): The user-agent info in the form of a dictionary or a string.
local_files_only (bool, optional: If `True`, avoid downloading the file and return the path to the
local_files_only (bool, optional): If `True`, avoid downloading the file and return the path to the
local cached file if it exists. if `False`, download the file anyway even it exists.
cookies (CookieJar, optional): The cookie of download request.
@@ -201,7 +201,7 @@ def http_get_file(
http headers to carry necessary info when requesting the remote file
Raises:
FileDownloadError: Failed download failed.
FileDownloadError: File download failed.
"""
total = -1

View File

@@ -252,6 +252,7 @@ class Pipelines(object):
body_3d_keypoints = 'canonical_body-3d-keypoints_video'
hand_2d_keypoints = 'hrnetv2w18_hand-2d-keypoints_image'
human_detection = 'resnet18-human-detection'
tbs_detection = 'tbs-detection'
object_detection = 'vit-object-detection'
abnormal_object_detection = 'abnormal-object-detection'
easycv_detection = 'easycv-detection'
@@ -406,6 +407,7 @@ class Pipelines(object):
dialog_state_tracking = 'dialog-state-tracking'
zero_shot_classification = 'zero-shot-classification'
text_error_correction = 'text-error-correction'
word_alignment = 'word-alignment'
plug_generation = 'plug-generation'
gpt3_generation = 'gpt3-generation'
gpt_moe_generation = 'gpt-moe-generation'
@@ -928,6 +930,7 @@ class Preprocessors(object):
sbert_token_cls_tokenizer = 'sbert-token-cls-tokenizer'
zero_shot_cls_tokenizer = 'zero-shot-cls-tokenizer'
text_error_correction = 'text-error-correction'
word_alignment = 'word-alignment'
sentence_embedding = 'sentence-embedding'
text_ranking = 'text-ranking'
sequence_labeling_tokenizer = 'sequence-labeling-tokenizer'

View File

@@ -175,7 +175,7 @@ class CiderScorer(object):
:return: array of score for each n-grams cosine similarity
'''
delta = float(length_hyp - length_ref)
# measure consine similarity
# measure cosine similarity
val = np.array([0.0 for _ in range(self.n)])
for n in range(self.n):
# ngram

View File

@@ -14,9 +14,9 @@ from .builder import METRICS, MetricKeys
@METRICS.register_module(
group_key=default_group, module_name=Metrics.multi_average_precision)
class AveragePrecisionMetric(Metric):
"""The metric computation class for multi avarage precision classes.
"""The metric computation class for multi average precision classes.
This metric class calculates multi avarage precision for the whole input batches.
This metric class calculates multi average precision for the whole input batches.
"""
def __init__(self, *args, **kwargs):

View File

@@ -26,7 +26,7 @@ def calculate_weights_indices(in_length, out_length, scale, kernel,
out_length (int): Output length.
scale (float): Scale factor.
kernel_width (int): Kernel width.
antialisaing (bool): Whether to apply anti-aliasing when downsampling.
antialiasing (bool): Whether to apply anti-aliasing when downsampling.
"""
if (scale < 1) and antialiasing:
@@ -98,7 +98,7 @@ def imresize(img, scale, antialiasing=True):
Numpy: Input image with shape (h, w, c), [0, 1] range.
scale (float): Scale factor. The same scale applies for both height
and width.
antialisaing (bool): Whether to apply anti-aliasing when downsampling.
antialiasing (bool): Whether to apply anti-aliasing when downsampling.
Default: True.
Returns:
Tensor: Output image with shape (c, h, w), [0, 1] range, w/o round.

View File

@@ -26,7 +26,7 @@ def estimate_aggd_param(block):
block (ndarray): 2D Image block.
Returns:
tuple: alpha (float), beta_l (float) and beta_r (float) for the AGGD
distribution (Estimating the parames in Equation 7 in the paper).
distribution (Estimating the parameters in Equation 7 in the paper).
"""
block = block.flatten()
gam = np.arange(0.2, 10.001, 0.001) # len = 9801
@@ -124,7 +124,7 @@ def niqe(img,
feat = []
for idx_w in range(num_block_w):
for idx_h in range(num_block_h):
# process ecah block
# process each block
block = img_nomalized[idx_h * block_size_h // scale:(idx_h + 1)
* block_size_h // scale,
idx_w * block_size_w // scale:(idx_w + 1)

View File

@@ -273,8 +273,8 @@ def si_snr(s1, s2, eps=1e-8):
s1_s2_norm = l2_norm(s1, s2)
s2_s2_norm = l2_norm(s2, s2)
s_target = s1_s2_norm / (s2_s2_norm + eps) * s2
e_nosie = s1 - s_target
e_noise = s1 - s_target
target_norm = l2_norm(s_target, s_target)
noise_norm = l2_norm(e_nosie, e_nosie)
noise_norm = l2_norm(e_noise, e_noise)
snr = 10 * torch.log10((target_norm) / (noise_norm + eps) + eps)
return torch.mean(snr)

View File

@@ -126,7 +126,7 @@ class PQMF(torch.nn.Module):
Tensor: Output tensor (B, 1, T).
"""
# NOTE(kan-bayashi): Power will be dreased so here multipy by # subbands.
# NOTE(kan-bayashi): Power will be dreased so here multiply by # subbands.
# Not sure this is the correct way, it is better to check again.
x = F.conv_transpose1d(
x, self.updown_filter * self.subbands, stride=self.subbands)

View File

@@ -628,7 +628,7 @@ class PostNet(nn.Module):
def forward(self, x, mask=None):
postnet_fsmn_output = self.fsmn(x, mask)
# The input can also be a packed variable length sequence,
# here we just omit it for simpliciy due to the mask and uni-directional lstm.
# here we just omit it for simplicity due to the mask and uni-directional lstm.
postnet_lstm_output, _ = self.lstm(postnet_fsmn_output)
mel_residual_output = self.fc(postnet_lstm_output)
@@ -736,7 +736,7 @@ class KanTtsSAMBERT(nn.Module):
def binarize_attention_parallel(self, attn, in_lens, out_lens):
"""For training purposes only. Binarizes attention with MAS.
These will no longer recieve a gradient.
These will no longer receive a gradient.
Args:
attn: B x 1 x max_mel_len x max_text_len

View File

@@ -411,7 +411,7 @@ class AudioProcessor:
self.badcase_list.append(wav_basename)
else:
durs, phone_list = result
# Algin length with melspec
# Align length with melspec
if len(self.mel_dict) > 0:
pair_mel = self.mel_dict.get(wav_basename, None)
if pair_mel is None:

View File

@@ -33,7 +33,7 @@ def save_wav(wav, path, sr):
quant_wav = 32767 * wav
else:
quant_wav = wav
# maxmize the volume to avoid clipping
# maximize the volume to avoid clipping
# wav *= 32767 / max(0.01, np.max(np.abs(wav)))
wavfile.write(path, sr, quant_wav.astype(np.int16))

View File

@@ -514,7 +514,7 @@ def average_by_duration(x, durs):
return None
durs_cum = np.cumsum(np.pad(durs, (1, 0), 'constant'))
# average over each symbol's duraion
# average over each symbol's duration
x_symbol = np.zeros((durs.shape[0], ), dtype=np.float32)
for idx, start, end in zip(
range(durs.shape[0]), durs_cum[:-1], durs_cum[1:]):

View File

@@ -61,7 +61,7 @@ def do_prosody_text_normalization(line):
text = text.replace('"', ' ')
text = text.replace(
'-',
'') # don't replace by space because compond word like two-year-old
'') # don't replace by space because compound word like two-year-old
text = text.replace(
"'", '') # don't replace by space because English word like that's

View File

@@ -24,7 +24,7 @@ class Head(ABC):
def forward(self, *args, **kwargs) -> Dict[str, Any]:
"""
This method will use the output from backbone model to do any
downstream tasks. Recieve The output from backbone model.
downstream tasks. Receive The output from backbone model.
Returns (Dict[str, Any]): The output from downstream task.
"""

View File

@@ -1,6 +1,6 @@
# Copyright (c) OpenMMLab. All rights reserved.
# Implementation in this file is modified based on mmdetection
# Originally Apache 2.0 License and publicly avaialbe at https://github.com/open-mmlab/mmdetection
# Originally Apache 2.0 License and publicly available at https://github.com/open-mmlab/mmdetection
import torch
from mmdet.core import bbox2roi
from mmdet.models.builder import HEADS, build_head

View File

@@ -1,6 +1,6 @@
# Copyright (c) OpenMMLab. All rights reserved.
# Implementation in this file is modified based on mmdetection
# Originally Apache 2.0 License and publicly avaialbe at https://github.com/open-mmlab/mmdetection
# Originally Apache 2.0 License and publicly available at https://github.com/open-mmlab/mmdetection
import torch
from mmcv.runner import force_fp32
from mmdet.models.builder import ROI_EXTRACTORS

View File

@@ -1063,7 +1063,7 @@ class BaseHead(nn.Module, metaclass=ABCMeta):
elif labels.dim() == 1 and labels.size()[0] == self.num_classes \
and cls_score.size()[0] == 1:
# Fix a bug when training with soft labels and batch size is 1.
# When using soft labels, `labels` and `cls_socre` share the same
# When using soft labels, `labels` and `cls_score` share the same
# shape.
labels = labels.unsqueeze(0)

View File

@@ -1,4 +1,4 @@
"""
The implementation here is modified based on insightface, originally MIT license and publicly avaialbe at
The implementation here is modified based on insightface, originally MIT license and publicly available at
https://github.com/deepinsight/insightface/tree/master/detection/scrfd/mmdet
"""

View File

@@ -1,5 +1,5 @@
"""
The implementation here is modified based on insightface, originally MIT license and publicly avaialbe at
The implementation here is modified based on insightface, originally MIT license and publicly available at
https://github.com/deepinsight/insightface/tree/master/detection/scrfd/mmdet/core/bbox
"""
from .transforms import bbox2result, distance2kps, kps2distance

View File

@@ -1,5 +1,5 @@
"""
The implementation here is modified based on insightface, originally MIT license and publicly avaialbe at
The implementation here is modified based on insightface, originally MIT license and publicly available at
https://github.com/deepinsight/insightface/tree/master/detection/scrfd/mmdet/core/bbox/transforms.py
"""
import numpy as np

View File

@@ -1,5 +1,5 @@
"""
The implementation here is modified based on insightface, originally MIT license and publicly avaialbe at
The implementation here is modified based on insightface, originally MIT license and publicly available at
https://github.com/deepinsight/insightface/tree/master/detection/scrfd/mmdet/core/post_processing/bbox_nms.py
"""
from .bbox_nms import multiclass_nms

View File

@@ -1,5 +1,5 @@
"""
The implementation here is modified based on insightface, originally MIT license and publicly avaialbe at
The implementation here is modified based on insightface, originally MIT license and publicly available at
https://github.com/deepinsight/insightface/tree/master/detection/scrfd/mmdet/core/post_processing/bbox_nms.py
"""
import torch

View File

@@ -1,5 +1,5 @@
"""
The implementation here is modified based on insightface, originally MIT license and publicly avaialbe at
The implementation here is modified based on insightface, originally MIT license and publicly available at
https://github.com/deepinsight/insightface/tree/master/detection/scrfd/mmdet/datasets
"""
from .retinaface import RetinaFaceDataset

View File

@@ -1,5 +1,5 @@
"""
The implementation here is modified based on insightface, originally MIT license and publicly avaialbe at
The implementation here is modified based on insightface, originally MIT license and publicly available at
https://github.com/deepinsight/insightface/tree/master/detection/scrfd/mmdet/datasets/pipelines
"""
from .auto_augment import RotateV2

View File

@@ -1,5 +1,5 @@
"""
The implementation here is modified based on insightface, originally MIT license and publicly avaialbe at
The implementation here is modified based on insightface, originally MIT license and publicly available at
https://github.com/deepinsight/insightface/tree/master/detection/scrfd/mmdet/datasets/pipelines/auto_augment.py
"""
import copy

View File

@@ -1,5 +1,5 @@
"""
The implementation here is modified based on insightface, originally MIT license and publicly avaialbe at
The implementation here is modified based on insightface, originally MIT license and publicly available at
https://github.com/deepinsight/insightface/tree/master/detection/scrfd/mmdet/datasets/pipelines/formating.py
"""
import numpy as np

View File

@@ -1,5 +1,5 @@
"""
The implementation here is modified based on insightface, originally MIT license and publicly avaialbe at
The implementation here is modified based on insightface, originally MIT license and publicly available at
https://github.com/deepinsight/insightface/tree/master/detection/scrfd/mmdet/datasets/pipelines/loading.py
"""
import os.path as osp

View File

@@ -1,5 +1,5 @@
"""
The implementation here is modified based on insightface, originally MIT license and publicly avaialbe at
The implementation here is modified based on insightface, originally MIT license and publicly available at
https://github.com/deepinsight/insightface/tree/master/detection/scrfd/mmdet/datasets/pipelines/transforms.py
"""
import mmcv

View File

@@ -1,5 +1,5 @@
"""
The implementation here is modified based on insightface, originally MIT license and publicly avaialbe at
The implementation here is modified based on insightface, originally MIT license and publicly available at
https://github.com/deepinsight/insightface/tree/master/detection/scrfd/mmdet/datasets/retinaface.py
"""
import numpy as np

View File

@@ -1,5 +1,5 @@
"""
The implementation here is modified based on insightface, originally MIT license and publicly avaialbe at
The implementation here is modified based on insightface, originally MIT license and publicly available at
https://github.com/deepinsight/insightface/tree/master/detection/scrfd/mmdet/models
"""
from .dense_heads import * # noqa: F401,F403

View File

@@ -1,5 +1,5 @@
"""
The implementation here is modified based on insightface, originally MIT license and publicly avaialbe at
The implementation here is modified based on insightface, originally MIT license and publicly available at
https://github.com/deepinsight/insightface/tree/master/detection/scrfd/mmdet/models/backbones
"""
from .mobilenet import MobileNetV1

View File

@@ -1,5 +1,5 @@
"""
The implementation here is modified based on insightface, originally MIT license and publicly avaialbe at
The implementation here is modified based on insightface, originally MIT license and publicly available at
https://github.com/deepinsight/insightface/tree/master/detection/scrfd/mmdet/models/backbones/mobilenet.py
"""

View File

@@ -1,5 +1,5 @@
"""
The implementation here is modified based on insightface, originally MIT license and publicly avaialbe at
The implementation here is modified based on insightface, originally MIT license and publicly available at
https://github.com/deepinsight/insightface/tree/master/detection/scrfd/mmdet/models/backbones/resnet.py
"""
import torch.nn as nn

View File

@@ -1,5 +1,5 @@
"""
The implementation here is modified based on insightface, originally MIT license and publicly avaialbe at
The implementation here is modified based on insightface, originally MIT license and publicly available at
https://github.com/deepinsight/insightface/tree/master/detection/scrfd/mmdet/models/dense_heads
"""
from .scrfd_head import SCRFDHead

View File

@@ -1,5 +1,5 @@
"""
The implementation here is modified based on insightface, originally MIT license and publicly avaialbe at
The implementation here is modified based on insightface, originally MIT license and publicly available at
https://github.com/deepinsight/insightface/tree/master/detection/scrfd/mmdet/models/dense_heads/scrfd_head.py
"""
import numpy as np

View File

@@ -1,5 +1,5 @@
"""
The implementation here is modified based on insightface, originally MIT license and publicly avaialbe at
The implementation here is modified based on insightface, originally MIT license and publicly available at
https://github.com/deepinsight/insightface/tree/master/detection/scrfd/mmdet/models/detectors
"""
from .scrfd import SCRFD

View File

@@ -1,5 +1,5 @@
"""
The implementation here is modified based on insightface, originally MIT license and publicly avaialbe at
The implementation here is modified based on insightface, originally MIT license and publicly available at
https://github.com/deepinsight/insightface/tree/master/detection/scrfd/mmdet/models/detectors/scrfd.py
"""
import torch

View File

@@ -1,5 +1,5 @@
"""
The implementation here is modified based on insightface, originally MIT license and publicly avaialbe at
The implementation here is modified based on insightface, originally MIT license and publicly available at
https://github.com/deepinsight/insightface/tree/master/detection/scrfd/mmdet/models/detectors/scrfd.py
"""
import torch

View File

@@ -1,5 +1,5 @@
# The implementation here is modified based on EfficientNet,
# originally Apache 2.0 License and publicly avaialbe at https://github.com/lukemelas/EfficientNet-PyTorch
# originally Apache 2.0 License and publicly available at https://github.com/lukemelas/EfficientNet-PyTorch
from .model import VALID_MODELS, EfficientNet
from .utils import (BlockArgs, BlockDecoder, GlobalParams, efficientnet,

View File

@@ -1,5 +1,5 @@
# The implementation here is modified based on EfficientNet,
# originally Apache 2.0 License and publicly avaialbe at https://github.com/lukemelas/EfficientNet-PyTorch
# originally Apache 2.0 License and publicly available at https://github.com/lukemelas/EfficientNet-PyTorch
import torch
from torch import nn

View File

@@ -1,5 +1,5 @@
# The implementation here is modified based on EfficientNet,
# originally Apache 2.0 License and publicly avaialbe at https://github.com/lukemelas/EfficientNet-PyTorch
# originally Apache 2.0 License and publicly available at https://github.com/lukemelas/EfficientNet-PyTorch
import collections
import math

View File

@@ -1,5 +1,5 @@
# The implementation here is modified based on nanodet,
# originally Apache 2.0 License and publicly avaialbe at https://github.com/RangiLyu/nanodet
# originally Apache 2.0 License and publicly available at https://github.com/RangiLyu/nanodet
import math

View File

@@ -1,5 +1,5 @@
# The implementation here is modified based on nanodet,
# originally Apache 2.0 License and publicly avaialbe at https://github.com/RangiLyu/nanodet
# originally Apache 2.0 License and publicly available at https://github.com/RangiLyu/nanodet
import math

View File

@@ -1,5 +1,5 @@
# The implementation here is modified based on nanodet,
# originally Apache 2.0 License and publicly avaialbe at https://github.com/RangiLyu/nanodet
# originally Apache 2.0 License and publicly available at https://github.com/RangiLyu/nanodet
import torch
import torch.nn as nn

View File

@@ -1,5 +1,5 @@
# The implementation here is modified based on nanodet,
# originally Apache 2.0 License and publicly avaialbe at https://github.com/RangiLyu/nanodet
# originally Apache 2.0 License and publicly available at https://github.com/RangiLyu/nanodet
import torch
import torch.nn as nn

View File

@@ -1,5 +1,5 @@
# The implementation here is modified based on nanodet,
# originally Apache 2.0 License and publicly avaialbe at https://github.com/RangiLyu/nanodet
# originally Apache 2.0 License and publicly available at https://github.com/RangiLyu/nanodet
import torch
import torch.nn as nn

View File

@@ -1,5 +1,5 @@
"""
The implementation here is modified based on insightface, originally MIT license and publicly avaialbe at
The implementation here is modified based on insightface, originally MIT license and publicly available at
https://github.com/deepinsight/insightface/blob/master/python-package/insightface/utils/face_align.py
"""
import cv2

View File

@@ -1,6 +1,6 @@
""" HandStatic
The implementation here is modified based on MobileFaceNet,
originally Apache 2.0 License and publicly avaialbe at https://github.com/xuexingyu24/MobileFaceNet_Tutorial_Pytorch
originally Apache 2.0 License and publicly available at https://github.com/xuexingyu24/MobileFaceNet_Tutorial_Pytorch
"""
import os

View File

@@ -1,5 +1,5 @@
# The implementation here is adopted from ddpm-segmentation,
# originally Apache 2.0 License and publicly avaialbe at https://github.com/yandex-research/ddpm-segmentation
# originally Apache 2.0 License and publicly available at https://github.com/yandex-research/ddpm-segmentation
def get_palette(category):

View File

@@ -1,5 +1,5 @@
# The implementation here is modified based on ddpm-segmentation,
# originally Apache 2.0 License and publicly avaialbe at https://github.com/yandex-research/ddpm-segmentation
# originally Apache 2.0 License and publicly available at https://github.com/yandex-research/ddpm-segmentation
# Copyright (c) Alibaba, Inc. and its affiliates.
from typing import List

View File

@@ -1,5 +1,5 @@
# The implementation here is modified based on ddpm-segmentation,
# originally Apache 2.0 License and publicly avaialbe at https://github.com/yandex-research/ddpm-segmentation
# originally Apache 2.0 License and publicly available at https://github.com/yandex-research/ddpm-segmentation
# Copyright (c) Alibaba, Inc. and its affiliates.
import os

View File

@@ -1,5 +1,5 @@
# The implementation here is modified based on ddpm-segmentation,
# originally Apache 2.0 License and publicly avaialbe at https://github.com/yandex-research/ddpm-segmentation
# originally Apache 2.0 License and publicly available at https://github.com/yandex-research/ddpm-segmentation
# Copyright (c) Alibaba, Inc. and its affiliates.
import os.path as osp

View File

@@ -1,4 +1,4 @@
# Part of the implementation is borrowed and modified from CLIP, publicly avaialbe at https://github.com/openai/CLIP.
# Part of the implementation is borrowed and modified from CLIP, publicly available at https://github.com/openai/CLIP.
# Copyright 2021-2022 The Alibaba Fundamental Vision Team Authors. All rights reserved.
import math

View File

@@ -1,4 +1,4 @@
# Part of the implementation is borrowed and modified from CLIP, publicly avaialbe at https://github.com/openai/CLIP.
# Part of the implementation is borrowed and modified from CLIP, publicly available at https://github.com/openai/CLIP.
# Copyright 2021-2022 The Alibaba Fundamental Vision Team Authors. All rights reserved.
import math

View File

@@ -1,5 +1,5 @@
# Part of the implementation is borrowed and modified from latent-diffusion,
# publicly avaialbe at https://github.com/CompVis/latent-diffusion.
# publicly available at https://github.com/CompVis/latent-diffusion.
# Copyright 2021-2022 The Alibaba Fundamental Vision Team Authors. All rights reserved.
import math

View File

@@ -1,5 +1,5 @@
# The implementation here is modified based on BaSSL,
# originally Apache 2.0 License and publicly avaialbe at https://github.com/kakaobrain/bassl
# originally Apache 2.0 License and publicly available at https://github.com/kakaobrain/bassl
import math
import os

View File

@@ -1,5 +1,5 @@
# The implementation here is modified based on BaSSL,
# originally Apache 2.0 License and publicly avaialbe at https://github.com/kakaobrain/bassl
# originally Apache 2.0 License and publicly available at https://github.com/kakaobrain/bassl
import torch.nn as nn
import torch.nn.functional as F

View File

@@ -1,5 +1,5 @@
# The implementation here is modified based on SceneSeg,
# originally Apache 2.0 License and publicly avaialbe at https://github.com/AnyiRao/SceneSeg
# originally Apache 2.0 License and publicly available at https://github.com/AnyiRao/SceneSeg
import os
import os.path as osp
import subprocess

View File

@@ -1,5 +1,5 @@
# Implementation in this file is modified based on ViTAE-Transformer
# Originally Apache 2.0 License and publicly avaialbe at https://github.com/ViTAE-Transformer/ViTDet
# Originally Apache 2.0 License and publicly available at https://github.com/ViTAE-Transformer/ViTDet
from .backbones import ViT
from .dense_heads import AnchorNHead, RPNNHead
from .necks import FPNF

View File

@@ -1,5 +1,5 @@
# Implementation in this file is modified based on ViTAE-Transformer
# Originally Apache 2.0 License and publicly avaialbe at https://github.com/ViTAE-Transformer/ViTDet
# Originally Apache 2.0 License and publicly available at https://github.com/ViTAE-Transformer/ViTDet
from .vit import ViT
__all__ = ['ViT']

View File

@@ -1,5 +1,5 @@
# Implementation in this file is modified based on ViTAE-Transformer
# Originally Apache 2.0 License and publicly avaialbe at https://github.com/ViTAE-Transformer/ViTDet
# Originally Apache 2.0 License and publicly available at https://github.com/ViTAE-Transformer/ViTDet
from .anchor_head import AnchorNHead
from .rpn_head import RPNNHead

View File

@@ -1,6 +1,6 @@
# Copyright (c) OpenMMLab. All rights reserved.
# Implementation in this file is modified based on ViTAE-Transformer
# Originally Apache 2.0 License and publicly avaialbe at https://github.com/ViTAE-Transformer/ViTDet
# Originally Apache 2.0 License and publicly available at https://github.com/ViTAE-Transformer/ViTDet
from mmdet.models.builder import HEADS
from mmdet.models.dense_heads import AnchorHead

View File

@@ -1,6 +1,6 @@
# Copyright (c) OpenMMLab. All rights reserved.
# Implementation in this file is modified based on ViTAE-Transformer
# Originally Apache 2.0 License and publicly avaialbe at https://github.com/ViTAE-Transformer/ViTDet
# Originally Apache 2.0 License and publicly available at https://github.com/ViTAE-Transformer/ViTDet
import copy
import torch

View File

@@ -1,5 +1,5 @@
# Implementation in this file is modified based on ViTAE-Transformer
# Originally Apache 2.0 License and publicly avaialbe at https://github.com/ViTAE-Transformer/ViTDet
# Originally Apache 2.0 License and publicly available at https://github.com/ViTAE-Transformer/ViTDet
from .fpn import FPNF
__all__ = ['FPNF']

View File

@@ -1,6 +1,6 @@
# Copyright (c) OpenMMLab. All rights reserved.
# Implementation in this file is modified based on ViTAE-Transformer
# Originally Apache 2.0 License and publicly avaialbe at https://github.com/ViTAE-Transformer/ViTDet
# Originally Apache 2.0 License and publicly available at https://github.com/ViTAE-Transformer/ViTDet
import torch.nn as nn
import torch.nn.functional as F
from mmcv.runner import BaseModule, auto_fp16

View File

@@ -1,5 +1,5 @@
# Implementation in this file is modified based on ViTAE-Transformer
# Originally Apache 2.0 License and publicly avaialbe at https://github.com/ViTAE-Transformer/ViTDet
# Originally Apache 2.0 License and publicly available at https://github.com/ViTAE-Transformer/ViTDet
from .bbox_heads import (ConvFCBBoxNHead, Shared2FCBBoxNHead,
Shared4Conv1FCBBoxNHead)
from .mask_heads import FCNMaskNHead

View File

@@ -1,5 +1,5 @@
# Implementation in this file is modified based on ViTAE-Transformer
# Originally Apache 2.0 License and publicly avaialbe at https://github.com/ViTAE-Transformer/ViTDet
# Originally Apache 2.0 License and publicly available at https://github.com/ViTAE-Transformer/ViTDet
from .convfc_bbox_head import (ConvFCBBoxNHead, Shared2FCBBoxNHead,
Shared4Conv1FCBBoxNHead)

View File

@@ -1,6 +1,6 @@
# Copyright (c) OpenMMLab. All rights reserved.
# Implementation in this file is modified based on ViTAE-Transformer
# Originally Apache 2.0 License and publicly avaialbe at https://github.com/ViTAE-Transformer/ViTDet
# Originally Apache 2.0 License and publicly available at https://github.com/ViTAE-Transformer/ViTDet
import torch.nn as nn
from mmdet.models.builder import HEADS
from mmdet.models.roi_heads.bbox_heads.bbox_head import BBoxHead

View File

@@ -1,5 +1,5 @@
# Implementation in this file is modified based on ViTAE-Transformer
# Originally Apache 2.0 License and publicly avaialbe at https://github.com/ViTAE-Transformer/ViTDet
# Originally Apache 2.0 License and publicly available at https://github.com/ViTAE-Transformer/ViTDet
from .fcn_mask_head import FCNMaskNHead
__all__ = ['FCNMaskNHead']

View File

@@ -1,6 +1,6 @@
# Copyright (c) OpenMMLab. All rights reserved.
# Implementation in this file is modified based on ViTAE-Transformer
# Originally Apache 2.0 License and publicly avaialbe at https://github.com/ViTAE-Transformer/ViTDet
# Originally Apache 2.0 License and publicly available at https://github.com/ViTAE-Transformer/ViTDet
from warnings import warn
import numpy as np

View File

@@ -1,5 +1,5 @@
# Implementation in this file is modified based on ViTAE-Transformer
# Originally Apache 2.0 License and publicly avaialbe at https://github.com/ViTAE-Transformer/ViTDet
# Originally Apache 2.0 License and publicly available at https://github.com/ViTAE-Transformer/ViTDet
from .checkpoint import load_checkpoint
from .convModule_norm import ConvModule_Norm

View File

@@ -1,6 +1,6 @@
# Copyright (c) Open-MMLab. All rights reserved.
# Implementation in this file is modified based on ViTAE-Transformer
# Originally Apache 2.0 License and publicly avaialbe at https://github.com/ViTAE-Transformer/ViTDet
# Originally Apache 2.0 License and publicly available at https://github.com/ViTAE-Transformer/ViTDet
import io
import os
import os.path as osp

View File

@@ -1,5 +1,5 @@
# Implementation in this file is modified based on ViTAE-Transformer
# Originally Apache 2.0 License and publicly avaialbe at https://github.com/ViTAE-Transformer/ViTDet
# Originally Apache 2.0 License and publicly available at https://github.com/ViTAE-Transformer/ViTDet
from mmcv.cnn import ConvModule

View File

@@ -1,5 +1,5 @@
"""
The implementation here is modified based on PETR, originally Apache-2.0 license and publicly avaialbe at
The implementation here is modified based on PETR, originally Apache-2.0 license and publicly available at
https://github.com/megvii-research/PETR/blob/main/projects/mmdet3d_plugin
"""
from .core.bbox.assigners import HungarianAssigner3D

View File

@@ -1,5 +1,5 @@
"""
The implementation here is modified based on PETR, originally Apache-2.0 license and publicly avaialbe at
The implementation here is modified based on PETR, originally Apache-2.0 license and publicly available at
https://github.com/megvii-research/PETR/blob/main/projects/mmdet3d_plugin/core/bbox/assigners
"""
from .hungarian_assigner_3d import HungarianAssigner3D

View File

@@ -1,5 +1,5 @@
"""
The implementation here is modified based on PETR, originally Apache-2.0 license and publicly avaialbe at
The implementation here is modified based on PETR, originally Apache-2.0 license and publicly available at
https://github.com/megvii-research/PETR/blob/main/projects/mmdet3d_plugin/core/bbox/assigners
"""
import torch

View File

@@ -1,5 +1,5 @@
"""
The implementation here is modified based on PETR, originally Apache-2.0 license and publicly avaialbe at
The implementation here is modified based on PETR, originally Apache-2.0 license and publicly available at
https://github.com/megvii-research/PETR/blob/main/projects/mmdet3d_plugin/core/bbox/coders
"""
from .nms_free_coder import NMSFreeCoder

View File

@@ -1,5 +1,5 @@
"""
The implementation here is modified based on PETR, originally Apache-2.0 license and publicly avaialbe at
The implementation here is modified based on PETR, originally Apache-2.0 license and publicly available at
https://github.com/megvii-research/PETR/blob/main/projects/mmdet3d_plugin/core/bbox/coders
"""
import torch

View File

@@ -1,5 +1,5 @@
"""
The implementation here is modified based on PETR, originally Apache-2.0 license and publicly avaialbe at
The implementation here is modified based on PETR, originally Apache-2.0 license and publicly available at
https://github.com/megvii-research/PETR/blob/main/projects/mmdet3d_plugin/core/bbox/match_costs
"""
from .match_cost import BBox3DL1Cost

View File

@@ -1,5 +1,5 @@
"""
The implementation here is modified based on PETR, originally Apache-2.0 license and publicly avaialbe at
The implementation here is modified based on PETR, originally Apache-2.0 license and publicly available at
https://github.com/megvii-research/PETR/blob/main/projects/mmdet3d_plugin/core/bbox/match_costs
"""
import torch

View File

@@ -1,5 +1,5 @@
"""
The implementation here is modified based on PETR, originally Apache-2.0 license and publicly avaialbe at
The implementation here is modified based on PETR, originally Apache-2.0 license and publicly available at
https://github.com/megvii-research/PETR/blob/main/projects/mmdet3d_plugin/core/bbox
"""
import mmdet3d

View File

@@ -1,5 +1,5 @@
"""
The implementation here is modified based on PETR, originally Apache-2.0 license and publicly avaialbe at
The implementation here is modified based on PETR, originally Apache-2.0 license and publicly available at
https://github.com/megvii-research/PETR/blob/main/projects/mmdet3d_plugin/datasets
"""
from .nuscenes_dataset import CustomNuScenesDataset

View File

@@ -1,5 +1,5 @@
"""
The implementation here is modified based on PETR, originally Apache-2.0 license and publicly avaialbe at
The implementation here is modified based on PETR, originally Apache-2.0 license and publicly available at
https://github.com/megvii-research/PETR/blob/main/projects/mmdet3d_plugin/datasets
"""
import numpy as np

View File

@@ -1,5 +1,5 @@
"""
The implementation here is modified based on PETR, originally Apache-2.0 license and publicly avaialbe at
The implementation here is modified based on PETR, originally Apache-2.0 license and publicly available at
https://github.com/megvii-research/PETR/blob/main/projects/mmdet3d_plugin/datasets/pipelines
"""
from .loading import LoadMultiViewImageFromMultiSweepsFiles

View File

@@ -1,5 +1,5 @@
"""
The implementation here is modified based on PETR, originally Apache-2.0 license and publicly avaialbe at
The implementation here is modified based on PETR, originally Apache-2.0 license and publicly available at
https://github.com/megvii-research/PETR/blob/main/projects/mmdet3d_plugin/datasets/pipelines
"""
import mmcv

View File

@@ -1,5 +1,5 @@
"""
The implementation here is modified based on PETR, originally Apache-2.0 license and publicly avaialbe at
The implementation here is modified based on PETR, originally Apache-2.0 license and publicly available at
https://github.com/megvii-research/PETR/blob/main/projects/mmdet3d_plugin/datasets/pipelines
"""
import copy

View File

@@ -1,5 +1,5 @@
"""
The implementation here is modified based on PETR, originally Apache-2.0 license and publicly avaialbe at
The implementation here is modified based on PETR, originally Apache-2.0 license and publicly available at
https://github.com/megvii-research/PETR/blob/main/projects/mmdet3d_plugin/models/backbones
"""
from .vovnet import VoVNet

Some files were not shown because too many files have changed in this diff Show More