Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mjun0812/internimagewrapper
This repository provides an implementation for calling the "InternImage" model in a way similar to the timm library.
https://github.com/mjun0812/internimagewrapper
Last synced: about 2 months ago
JSON representation
This repository provides an implementation for calling the "InternImage" model in a way similar to the timm library.
- Host: GitHub
- URL: https://github.com/mjun0812/internimagewrapper
- Owner: mjun0812
- Created: 2023-10-01T08:09:36.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-01T12:52:30.000Z (about 1 year ago)
- Last Synced: 2023-11-01T20:40:09.165Z (about 1 year ago)
- Language: Python
- Size: 63.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# InternImage Wrapper
This repository provides an implementation for calling the "InternImage" model in a way similar to the timm library.
You can use InternImage as feature extractor.## Install
Before installing this repository, you need to install torch, timm, and CUDA
to build CUDA ext_module.```bash
pip install torch# Source Install
git clone https://github.com/mjun0812/InternImageWrapper.git
cd InternImageWrapper
python setup.py build install --user# pip install from github
pip install git+https://github.com/mjun0812/InternImageWrapper.git
```## Provided Model
- internimage_t_1k_224
- internimage_s_1k_224
- internimage_b_1k_224
- internimage_l_22kto1k_384
- internimage_xl_22kto1k_384
- internimage_h_22kto1k_384
- internimage_h_22kto1k_640
- internimage_g_22kto1k_512## Usage
InternImage has a DCNv3 module, which is written in C++ CUDA.
So, it does not run on CPUs.
To run on CPU, specify the `core_op="DCNv3_pytorch"` option.```python
import torch
import internimage# CUDA
model = internimage.create_model("internimage_b_1k_224")
model = internimage.create_model("internimage_b_1k_224", features_only=True)
model = internimage.create_model("internimage_b_1k_224", features_only=True, out_indices=[2, 3])# CPU
model = internimage.create_model("internimage_b_1k_224", core_op="DCNv3_pytorch")
```## Development
```bash
pip install -e . --user
```## ImageNet 1k Results
| name | core_op | resolution | acc@1 | acc@5 |
|----------------------------|---------------|------------|--------|--------|
| internimage_t_1k_224 | DCNv3(C++) | 224x224 | 83.472 | 96.530 |
| internimage_t_1k_224(fp16) | DCNv3(C++) | 224x224 | 83.470 | 96.532 |
| internimage_t_1k_224(bf16) | DCNv3(C++) | 224x224 | NoImpl | NoImpl |
| internimage_t_1k_224 | DCNv3_pytorch | 224x224 | 83.472 | 96.530 |
| internimage_t_1k_224(fp16) | DCNv3_pytorch | 224x224 | 83.480 | 96.532 |
| internimage_t_1k_224(bf16) | DCNv3_pytorch | 224x224 | 83.486 | 96.514 |
| internimage_l_22kto1k_384 | DCNv3(C++) | 384x384 | 87.712 | 98.384 |### ONNX
| name | core_op | resolution | acc@1 | acc@5 |
|----------------------|---------------|------------|--------|--------|
| internimage_t_1k_224 | DCNv3_pytorch | 224x224 | 83.470 | 96.532 |## References
- [Official Implementation](https://github.com/OpenGVLab/InternImage)
- [paper](https://arxiv.org/abs/2211.05778)
- [timm](https://github.com/huggingface/pytorch-image-models)