Skip to content

ChrisLisbon/TorchCNNBuilder

Repository files navigation

TorchCNNBuilder


Description in Russian is presented here.


TorchCNNBuilder is an open-source framework for the automatic creation of CNN architectures. This framework should first of all help researchers in the applicability of CNN models for a huge range of tasks, taking over most of the writing of the architecture code. This framework is distributed under the 3-Clause BSD license. All the functionality is written only using pytorch (no third-party dependencies).

Installation


The simplest way to install framework is using pip:

pip install torchcnnbuilder
Minimum technical requirements The minimum system requirements for using the library are a Python interpreter version >3.9 and access to a computing system running Windows/Linux. The minimum hardware requirements include a processor (CPU) with 8 cores, 2GB of RAM, and 2GB of HDD storage, as well as a graphics processing unit (GPU) with 8 GB of VRAM, supporting CUDA version 7 or higher.
Additional packages for examples run

Please note that when running examples from the examples folder, additional libraries are used to visualize and generate the dataset:

pip install numpy
pip install pytorch_msssim
pip install matplotlib
pip install tqdm

They are not required for the library to work, so their installation is optional.

Usage

To initialize simple model with encoder-decoder architecture call ForecasterBase class:

from torchcnnbuilder.models import ForecasterBase

model = ForecasterBase(input_size=[H, W],
                       in_time_points=C_in,
                       out_time_points=C_out,
                       n_layers=5)

Where [H, W] - size of image in pixels, C_in - number of input channels, C_out - number of out_channels.

To operate separately with encoder and decoder parts they can be called from model:

encoder = model.encoder
decoder = model.decoder

For GPU mode (device="cuda"), only graphics cards supporting CUDA version >=7 can be used. Otherwise, only CPU mode is available (you must set device="cpu").

Examples

Extensive usage scenarios can be found in examples folder.

Components calls and usage in folder usage_examples.

Documentation

Check the documentation here.

Development

In order to check available local Makefile commands run in the project root:

make help
help: Show help for each of the Makefile recipes.
lint: Lint the project with flake8 lib.
doc: Build and run the doc locally.

Application Areas

TorchCNNBuilder enables CNN architectures for diverse real-world applications across multiple domains:

Environmental Monitoring

  • Sea ice concentration forecasting
    Predict Arctic and Antarctic ice melt patterns to support climate research and maritime navigation safety using satellite imagery time series.

  • Climate pattern recognition
    Analyze large-scale atmospheric data to identify emerging weather patterns, extreme event precursors, and long-term climate trends.

  • Pollution level prediction
    Process multispectral sensor data to forecast air/water quality indices and identify pollution sources with spatial CNN architectures.

Remote Sensing

  • Satellite image analysis
    Process high-resolution multispectral imagery for applications ranging from urban planning to precision agriculture using specialized encoder architectures.

  • Land cover classification
    Automate large-scale terrain mapping with attention-based CNNs that handle spectral, spatial and temporal dimensions of data.

  • Disaster monitoring
    Develop change detection systems that compare pre/post-event satellite imagery to assess flood, fire or earthquake damage in near-real-time.

Medical Imaging

  • Automated diagnosis from X-ray/MRI scans
    Develop assistive diagnostic systems that can detect abnormalities in medical images with pixel-level precision while reducing radiologist workload.

  • Tumor segmentation
    Create 3D convolutional networks for precise volumetric analysis of cancerous growths in CT/MRI scans.

  • Medical time-series analysis
    Process sensor streams to predict patient deterioration through temporal features processing architectures.

Industrial Applications

  • Predictive maintenance
    Monitor equipment vibration patterns and thermal signatures to forecast mechanical failures.

  • Quality control in manufacturing
    Implement real-time visual inspection systems that detect defects in production lines.

Financial Forecasting

  • Time-series prediction
    Build hybrid CNN-LSTM architectures that extract both spatial patterns from market heatmaps and temporal dependencies from price histories.

  • Market trend analysis
    Process alternative data sources like satellite images of parking lots or social media sentiment through CNN architectures.

Sources


Contributing

Acknowledgement

The project is supported by FASIE - Foundation for Assistance to Small Innovative Enterprises.

About

Framework for the automatic creation of CNN architectures

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages