Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/agentmaker/paddle-image-models
A PaddlePaddle version image model zoo.
https://github.com/agentmaker/paddle-image-models
cait condensenet-v2 deit dla hardnet image model-zoo paddlepaddle pit pvt rednet repvgg rexnet swin-transformer tnt
Last synced: 2 months ago
JSON representation
A PaddlePaddle version image model zoo.
- Host: GitHub
- URL: https://github.com/agentmaker/paddle-image-models
- Owner: AgentMaker
- License: apache-2.0
- Created: 2021-03-18T08:55:50.000Z (almost 4 years ago)
- Default Branch: dev
- Last Pushed: 2021-11-13T05:15:02.000Z (about 3 years ago)
- Last Synced: 2023-11-07T18:21:04.334Z (about 1 year ago)
- Topics: cait, condensenet-v2, deit, dla, hardnet, image, model-zoo, paddlepaddle, pit, pvt, rednet, repvgg, rexnet, swin-transformer, tnt
- Language: Python
- Homepage:
- Size: 309 KB
- Stars: 128
- Watchers: 5
- Forks: 13
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Paddle-Image-Models
![GitHub forks](https://img.shields.io/github/forks/AgentMaker/Paddle-Image-Models)
![GitHub Repo stars](https://img.shields.io/github/stars/AgentMaker/Paddle-Image-Models)
![Pypi Downloads](https://pepy.tech/badge/ppim)
![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/AgentMaker/Paddle-Image-Models?include_prereleases)
![GitHub](https://img.shields.io/github/license/AgentMaker/Paddle-Image-Models)English | [简体中文](README_CN.md)
A PaddlePaddle version image model zoo.
Model Zoo
CNN
Transformer
MLP
## Install Package
* Install by pip:
```shell
$ pip install ppim
```
* Install by wheel package:[【Releases Packages】](https://github.com/AgentMaker/Paddle-Image-Models/releases)
## Usage
### Quick Start
```python
import paddle
from ppim import rednet_26
# Load the model with PPIM wheel package
model, val_transforms = rednet_26(pretrained=True, return_transforms=True)
# Load the model with paddle.hub API
# paddlepaddle >= 2.1.0
'''
model, val_transforms = paddle.hub.load(
'AgentMaker/Paddle-Image-Models:dev',
'rednet_26',
source='github',
force_reload=False,
pretrained=True,
return_transforms=True
)
'''
# Model summary
paddle.summary(model, input_size=(1, 3, 224, 224))
# Random a input
x = paddle.randn(shape=(1, 3, 224, 224))
# Model forword
out = model(x)
```
### Classification(PaddleHapi)
```python
import paddle
import paddle.nn as nn
import paddle.vision.transforms as T
from paddle.vision import Cifar100
from ppim import rexnet_1_0
# Load the model
model, val_transforms = rexnet_1_0(pretrained=True, return_transforms=True, class_dim=100)
# Use the PaddleHapi Model
model = paddle.Model(model)
# Set the optimizer
opt = paddle.optimizer.Adam(learning_rate=0.001, parameters=model.parameters())
# Set the loss function
loss = nn.CrossEntropyLoss()
# Set the evaluate metric
metric = paddle.metric.Accuracy(topk=(1, 5))
# Prepare the model
model.prepare(optimizer=opt, loss=loss, metrics=metric)
# Set the data preprocess
train_transforms = T.Compose([
T.Resize(256, interpolation='bicubic'),
T.RandomCrop(224),
T.ToTensor(),
T.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
])
# Load the Cifar100 dataset
train_dataset = Cifar100(mode='train', transform=train_transforms, backend='pil')
val_dataset = Cifar100(mode='test', transform=val_transforms, backend='pil')
# Finetune the model
model.fit(
train_data=train_dataset,
eval_data=val_dataset,
batch_size=256,
epochs=2,
eval_freq=1,
log_freq=1,
save_dir='save_models',
save_freq=1,
verbose=1,
drop_last=False,
shuffle=True,
num_workers=0
)
```
## Contact us
Email : [[email protected]]()
QQ Group : 1005109853