Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
zhaoxusheng 7ace5d8a15 | 1 year ago | |
---|---|---|
.idea | 1 year ago | |
configs | 1 year ago | |
docs | 1 year ago | |
examples | 1 year ago | |
mindcv | 1 year ago | |
requirements | 1 year ago | |
tests | 1 year ago | |
tutorials | 1 year ago | |
CONTRIBUTING.md | 1 year ago | |
LICENSE.md | 1 year ago | |
README.md | 1 year ago | |
RELEASE.md | 1 year ago | |
config.py | 1 year ago | |
inference.py | 1 year ago | |
quick_start.md | 1 year ago | |
requirements.txt | 1 year ago | |
setup.py | 1 year ago | |
test.py | 1 year ago | |
train.py | 1 year ago | |
train_with_func.py | 1 year ago | |
validate.py | 1 year ago | |
validate_with_func.py | 1 year ago |
MindCV is an open source toolbox for computer vision research and development based on MindSpore. It collects a large number of classic and SoTA vision models such ResNet and SwinTransformer with pretrained weights, and algorithms like MixUp, AutoAugment for boosting performance. With the decoupled module design, it is easy to apply or adapt MindCV to your own deep learning tasks.
Coming soon.
To install the dependency, please run
pip install -r requirements.txt
MindSpore can be easily installed by following the official instruction where you can select your hardware platform for the best fit. To run in distributed mode, openmpi is required to install.
The following instructions assume the desired dependency is fulfilled.
MindCV can be installed with pip.
pip install https://github.com/mindlab-ai/mindcv/releases/download/v0.0.1-beta/mindcv-0.0.1b0-py3-none-any.whl
To install MindCV from source, please run,
pip install git+https://github.com/mindlab-ai/mindcv.git
Please see the Quick Start Demo to help you get started with MindCV and learn about the basic usage quickly.
You can also see the finetune tutorial to learn how to apply a pretrained SoTA model to your own classification task.
Below is how to find and create a deep vision model quickly.
>>> import mindcv
# Search a wanted pretrained model
>>> mindcv.list_models("densenet*", pretrained=True)
['densenet201', 'densenet161', 'densenet169', 'densenet121']
# Create the model object
>>> network = mindcv.create_model('densenet121', pretrained=True)
It is easy to train your model on standard datasets or your own dataset with MindCV. Model training, transfer learning, or evaluaiton can be done using one or a few line of code with flexible configuration.
train.py
is the main script for model training, where you can set the dataset, data transformation, model, loss, LR scheduler, and optimizier easily. Here is the example for finetuning a pretrained DenseNet on CIFAR10 dataset using Adam optimizer.
python train.py --model=densenet121 --pretrained --opt=adam --lr=0.001 \
--dataset=cifar10 --num_classes=10 --dataset_download
Detailed adjustable parameters and their default value can be seen in config.py
For large datasets like ImageNet, it is necessary to do training in distributed mode on multiple devices, which is well supported in MindCV. The following script is an example for training DenseNet121 on ImageNet with 4 GPUs.
export CUDA_VISIBLE_DEVICES=0,1,2,3 # suppose there are 4 GPUs
mpirun --allow-run-as-root -n 4 python train.py --distribute \
--model=densenet121 --dataset=imagenet --data_dir=./datasets/imagenet
The yaml config files that yield competitive results on ImageNet for different models are listed in the configs
folder. To trigger training using preset yaml config,
mpirun --allow-run-as-root -n 4 python train.py -c configs/squeezenet/squeezenet_1.0_gpu.yaml
To validate a trained/pretrained model, you can use validate.py
.
# validate a trained checkpoint
python validate.py --model=resnet50 --dataset=imagenet --val_split=validation \
--ckpt_path='./ckpt/densenet121-best.ckpt'
# validate a pretrained SwinTransformer model
python validate.py --model=swin_tiny --dataset=imagenet --val_split=validation \
--pretrained
>>> {'Top_1_Accuracy': 0.808343989769821, 'Top_5_Accuracy': 0.9527253836317136, 'loss': 0.8474242982580839}
Validation during training can be enabled by setting the --val_while_train
argument, e.g.,
python train.py --model=resnet18 --dataset=cifar10 --val_while_train --val_split=test --val_interval=1
The training loss and validation accuracy for each epoch will be saved in ./CKPT_NAME/metric_log.txt
.
You can use mindcv.list_models()
to find out all supported models. It is easy to apply any of them to your tasks with these scripts. For more examples, see examples/scripts.
We provide jupyter notebook tutorials for
This project is released under the Apache License 2.0.
The dynamic version is still under development, if you find any issue or have an idea on new features, please don't hesitate to contact us via issue.
MindCV is an open source project that welcome any contribution and feedback. We wish that the toolbox and benchmark could serve the growing research community by providing a flexible as well as standardized toolkit to reimplement existing methods and develop their own new computer vision methods.
We appreciate all contributions to improve MindCV. Please refer to CONTRIBUTING.md for the contributing guideline.
If you find this project useful in your research, please consider citing:
@misc{MindSpore Computer Vision 2022,
title={{MindSpore Computer Vision}:MindSpore Computer Vision Toolbox and Benchmark},
author={MindSpore Vision Contributors},
howpublished = {\url{https://github.com/mindlab-ai/mindcv/}},
year={2022}
}
No Description
Jupyter Notebook Python Markdown Text
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》