YOLOX-Backbone
yolox-backbone is a deep-learning library and collection of YOLOX backbone models.
Install
pip install yolox-backbone
Load a Pretrained Model
Pretrained models can be loaded using yolox_backbone.create_model.
import yolox_backbone
m = yolox_backbone.create_model('yolox-s', pretrained=True)
m.eval()
Query the architecture information
After a feature backbone has been created, it can be queried to provide architecture information. The .scaling_factor attribute is a dictionary encapsulating the information about the scaling factor.
import yolox_backbone
m = yolox_backbone.create_model('yolox-s', pretrained=True)
print('Network scaling factor: ', m.scaling_factor)
Output:
Network scaling factor: {'depth': 0.33, 'width': 0.5}
Query the feature information
After a feature backbone has been created, it can be queried to provide channel information to the downstream heads without requiring static config or hardcoded constants. The .out_channels attribute is a dictionary encapsulating the information about the feature extraction points.
import yolox_backbone
m = yolox_backbone.create_model('yolox-s', pretrained=True)
print('Feature channels: ', m.out_channels)
Output:
Feature channels: {'P3': 128, 'P4': 256, 'P5': 512}
List Supported Models
import yolox_backbone
from pprint import pprint
model_names = yolox_backbone.list_models()
pprint(model_names)
Output:
['yolox-s',
'yolox-m',
'yolox-l',
'yolox-x',
'yolox-nano',
'yolox-tiny',
'yolox-darknet53']
Select specific feature levels
There is one creation argument impacting the output features.
out_featuresselects which FPN features to output
Support for different number of input channels
You can create the model without the constraint that the number of input channel is 3.
But you have to set pretrained to False.
import yolox_backbone
model = yolox_backbone.create_model(model_name=model_name,
pretrained=False,
input_tensor_channels=4,
out_features=["P3", "P4", "P5"]
)
Example
import yolox_backbone
import torch
from pprint import pprint
pprint(yolox_backbone.list_models())
model_names = yolox_backbone.list_models()
for model_name in model_names:
print("model_name: ", model_name)
model = yolox_backbone.create_model(model_name=model_name,
pretrained=True,
out_features=["P3", "P4", "P5"]
)
input_tensor = torch.randn((1, 3, 640, 640))
fpn_output_tensors = model(input_tensor)
p3 = fpn_output_tensors["P3"]
p4 = fpn_output_tensors["P4"]
p5 = fpn_output_tensors["P5"]
print("input_tensor.shape: ", input_tensor.shape)
print("p3.shape: ", p3.shape)
print("p4.shape: ", p4.shape)
print("p5.shape: ", p5.shape)
print("-" * 50)
Output:
['yolox-s', 'yolox-m', 'yolox-l', 'yolox-x', 'yolox-nano', 'yolox-tiny', 'yolox-darknet53']
model_name: yolox-s
input_tensor.shape: torch.Size([1, 3, 640, 640])
p3.shape: torch.Size([1, 128, 80, 80])
p4.shape: torch.Size([1, 256, 40, 40])
p5.shape: torch.Size([1, 512, 20, 20])
--------------------------------------------------
model_name: yolox-m
input_tensor.shape: torch.Size([1, 3, 640, 640])
p3.shape: torch.Size([1, 192, 80, 80])
p4.shape: torch.Size([1, 384, 40, 40])
p5.shape: torch.Size([1, 768, 20, 20])
--------------------------------------------------
model_name: yolox-l
input_tensor.shape: torch.Size([1, 3, 640, 640])
p3.shape: torch.Size([1, 256, 80, 80])
p4.shape: torch.Size([1, 512, 40, 40])
p5.shape: torch.Size([1, 1024, 20, 20])
--------------------------------------------------
model_name: yolox-x
input_tensor.shape: torch.Size([1, 3, 640, 640])
p3.shape: torch.Size([1, 320, 80, 80])
p4.shape: torch.Size([1, 640, 40, 40])
p5.shape: torch.Size([1, 1280, 20, 20])
--------------------------------------------------
model_name: yolox-nano
input_tensor.shape: torch.Size([1, 3, 640, 640])
p3.shape: torch.Size([1, 64, 80, 80])
p4.shape: torch.Size([1, 128, 40, 40])
p5.shape: torch.Size([1, 256, 20, 20])
--------------------------------------------------
model_name: yolox-tiny
input_tensor.shape: torch.Size([1, 3, 640, 640])
p3.shape: torch.Size([1, 96, 80, 80])
p4.shape: torch.Size([1, 192, 40, 40])
p5.shape: torch.Size([1, 384, 20, 20])
--------------------------------------------------
model_name: yolox-darknet53
input_tensor.shape: torch.Size([1, 3, 640, 640])
p3.shape: torch.Size([1, 128, 80, 80])
p4.shape: torch.Size([1, 256, 40, 40])
p5.shape: torch.Size([1, 512, 20, 20])
--------------------------------------------------
Acknowledgement
The docs are heavily based on timm docs. Thanks for their awesome works.
Metadata
Release files for yolox-backbone 0.0.1.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| yolox_backbone-0.0.1.9.tar.gz | 13.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| yolox_backbone-0.0.1.9-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 29.4 kB
Release files / yolox_backbone-0.0.1.9.tar.gz
| Download URL | yolox_backbone-0.0.1.9.tar.gz |
|---|---|
| Size | 13.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
577f85250e32c8e6bcc9f893fcf61c3f2e02ea3c7f8b4795466b45681884019b
|
|
BLAKE2b-256 checksum How to use checksums |
a0d93b5a9dee4d6691f1f899af56863d7c8fdf413db49ffb6b1462db44e899a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/59.5.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.5
|
Release files / yolox_backbone-0.0.1.9-py3-none-any.whl
| Download URL | yolox_backbone-0.0.1.9-py3-none-any.whl |
|---|---|
| Size | 15.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
13bd254884522bde49dc9200e6fcc795aaa5869b98fec3a0160920915c84c59d
|
|
BLAKE2b-256 checksum How to use checksums |
7428fc6982bd1a012c3b62d3a97311ae738f5f6036b7d0a4ee52899e3783d183
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/59.5.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.5
|
Security for yolox-backbone 0.0.1.9
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.