Skip to main content

Convolutional Neural Networks and utilities for Computer Vision

Project description

convnets

🚧 Under construction

Convolutional Neural Networks and utilities for Computer Vision.

Models API

convnets offers implementations for the following models:

To instantiate a model you need to import the corresponding class and pass a valid configuration object to the constructor:

from convnets.models import ResNet

r18_config = {
	'l': [
		{'r': 2, 'f': 64},
		{'r': 2, 'f': 128},
		{'r': 2, 'f': 256},
		{'r': 2, 'f': 512}
	], 
	'b': False
}

model = ResNet(r18_config)

Or you can use one of the predefined configurations, or variants:

from convnets.models import ResNet, ResNetConfig

model = ResNet(ResNetConfig.r18)

You can find the implementation of each model and configuration examples in the convnets/models directory.

Training API

If you want to train a model in your notebooks, you can use our fit function:

form convnets.train import fit 

hist = fit(model, dataloader, optimizer, criterion, metrics, max_epochs)

You can use any Pytorch model. You will need to define the Pytorch dataloader, optimizer and criterion. For the metrics, the function expects a dict with the name of the metric as key and the metric function as value. The metric function must receive the model output and the target and return a scalar value. You can find some examples in convnets/metrics. The max_epochs parameter is the maximum number of epochs to train the model. The function will return a dict with the training history.

Additionally, we offer a training script that you can execute from the command line.

python scripts/train.py <path_to_config_file>

You will have to pass the path to a yaml file with the configuration for your training, including the model, optimizer, criterion, metrics, dataloader, etc. You can find some examples in the configs directory (which are timm and pytorch-lightning compatible).

We also offer Pytorch Lightning interoperability.

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

convnets-0.2.9.tar.gz (15.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

convnets-0.2.9-py3-none-any.whl (21.8 kB view details)

Uploaded Python 3

File details

Details for the file convnets-0.2.9.tar.gz.

File metadata

  • Download URL: convnets-0.2.9.tar.gz
  • Upload date:
  • Size: 15.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.10.6 Linux/5.19.0-35-generic

File hashes

Hashes for convnets-0.2.9.tar.gz
Algorithm Hash digest
SHA256 ff26ff0ec54d812d1823068d05c40804786f8fb01c7a17a38a0249687cf825e2
MD5 aa886f8b44f664263b0db095798fa4d8
BLAKE2b-256 85ed4542ca9d8809ab52ee1492fb95dd440c7e0da1a883c4331f76c61c898ef5

See more details on using hashes here.

File details

Details for the file convnets-0.2.9-py3-none-any.whl.

File metadata

  • Download URL: convnets-0.2.9-py3-none-any.whl
  • Upload date:
  • Size: 21.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.10.6 Linux/5.19.0-35-generic

File hashes

Hashes for convnets-0.2.9-py3-none-any.whl
Algorithm Hash digest
SHA256 f2b68ca8323de965d65ef73c901a6a92b47c12de119583f450cd7e3d309e3355
MD5 f1186f0794ec5f35c3f82386f3fd98ab
BLAKE2b-256 13ac47ed745edfc1b5d0b21be4316b36491cd57afff6a5b592a5656f8c5c6f92

See more details on using hashes here.

Supported by

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