Skip to main content

Models and model utilities for common ML tasks

Project description

xt-models

Description

This repo contains common models and utilities for working with ML tasks, developed by Xtract AI.

More to come.

Installation

From PyPi:

pip install xt-models

From source:

git clone https://github.com/XtractTech/xt-models.git
pip install ./xt-models

Usage

Grabbing a segmentation model

from xt_models.models import ModelBuilder, SegmentationModule
from torch import nn

deep_sup_scale = 0.4
fc_dim = 2048
n_class = 2
net_encoder = ModelBuilder.build_encoder(
    arch="resnet50dilated",
    fc_dim=fc_dim,
    weights="/nasty/scratch/common/smart_objects/model/ade20k/encoder_epoch_20.pth"
)
net_decoder = ModelBuilder.build_decoder(
    arch="ppm_deepsup",
    fc_dim=fc_dim,
    num_class=150,
    weights="/nasty/scratch/common/smart_objects/model/ade20k/decoder_epoch_20.pth"
)
in_channels = net_decoder.conv_last[-1].in_channels
net_decoder.conv_last[-1] = nn.Conv2d(in_channels, n_class, kernel_size=(1, 1), stride=(1, 1))
net_decoder.conv_last_deepsup = nn.Conv2d(in_channels, n_class, 1, 1, 0)


model = SegmentationModule(net_encoder, net_decoder, deep_sup_scale)

Grabbing a detection model

from xt_models.models import Model

model_cfg = "./xt_models/models/object_detection/yolov5x.yaml"
model = Model(model_cfg)

Implementing a new model

If you are having to always copy and paste the same model code for different projects, simply add the model code to the models directory, and import it in the models/__init__.py file.

Data Sources

[descriptions and links to data]

Dependencies/Licensing

[list of dependencies and their licenses, including data]

References

[list of references]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xt-models-0.3.0.tar.gz (20.4 kB view details)

Uploaded Source

Built Distribution

xt_models-0.3.0-py3-none-any.whl (25.3 kB view details)

Uploaded Python 3

File details

Details for the file xt-models-0.3.0.tar.gz.

File metadata

  • Download URL: xt-models-0.3.0.tar.gz
  • Upload date:
  • Size: 20.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for xt-models-0.3.0.tar.gz
Algorithm Hash digest
SHA256 64b0f413e0c9761c351edeb8ece2506ff5f9715b5def4248e96a3bdbb4cf87c4
MD5 91a4e8f74d0e20aa374f9ae2e1ef5928
BLAKE2b-256 a59d733865acd016eaf6c82b261ea47829460aff35c1e44ebbdbc0b72785ae5f

See more details on using hashes here.

File details

Details for the file xt_models-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: xt_models-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 25.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for xt_models-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ec893d7c203732158147a5afed991584551ce71fece40a48d07246ffc52e3f8a
MD5 e5761ce662986962a0affd6ef9299070
BLAKE2b-256 b96b4f15e4683d0a4a7376b6d6bbd128608bf04a8fa9e21f2424077a431da12f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page