Skip to content

This repository contents different scripts for different models of neuron networks to allow you to train a model of image processing (classification, segmentation, object detection, image embedding etc).

License

Notifications You must be signed in to change notification settings

cacybernetic/CVA_NET

CVA_NET: COMPUTER VISION ANALYZING NETWORK

A comprehensive computer vision framework for easy model training and deployment

A powerful, user-friendly open-source computer vision framework that simplifies the process of training and deploying state-of-the-art neural network models for various computer vision tasks.

Table of Contents

Description

CVA_NET is an advanced computer vision framework designed to democratize AI by making complex computer vision tasks accessible to developers, researchers, and enthusiasts. Our platform provides a unified interface for training, evaluating, and deploying various neural network architectures with minimal setup and maximum flexibility.

Key advantages:

  • Easy Training: Simplified pipeline for training custom models
  • Multiple Architectures: Support for CNN, R-CNN, YOLO, Transformers, and more
  • Production Ready: Easy model export and deployment
  • Extensible: Modular design for custom implementations

Features

Model Training & Architecture

  • Image Classification: ResNet, EfficientNet, Vision Transformers
  • Object Detection: Faster R-CNN, YOLO variants, SSD
  • Instance Segmentation: Mask R-CNN, SOLO
  • Multi-task Learning: Simultaneous training for multiple objectives
  • Transfer Learning: Pre-trained models and fine-tuning capabilities

Data Processing

  • Advanced Augmentation: Comprehensive data augmentation pipeline
  • Dataset Management: Support for popular datasets (COCO, ImageNet, Pascal VOC)
  • Data Loaders: Optimized data loading for performance
  • Preprocessing: Built-in normalization and transformation

Training & Evaluation

  • Distributed Training: Multi-GPU training support
  • Hyperparameter Optimization: Automated tuning capabilities
  • Visualization: Real-time training metrics and loss visualization
  • Model Checkpointing: Automatic saving and resuming

Deployment

  • Model Export: Export to ONNX, TorchScript, TensorFlow SavedModel
  • Inference API: Simple inference interface
  • Web Demo: Built-in web interface for model testing

Installation

To install the project, make sure you have Python 3.8 or later version and pip installed on your machine. And then run the following command lines.

For Linux

git clone https://github.com/cacybernetic/CVA_NET;
cd CVA_NET;
sudo rm -r .git;
git init;  # To create a new instance of git repository

OS dependences

Ubuntu

Open your terminal and run following command lines to add the deadsnakes PPA to your system:

sudo apt update;
sudo apt install software-properties-common -y;
sudo add-apt-repository ppa:deadsnakes/ppa -y

Refresh your package list to include the deadsnakes PPA and then install Python 3.10:

sudo apt update;
sudo apt install python3.10;
python3.10 --version

NOTE: Do not change the default Python version of Ubuntu, as it may break system tools that depend on it.

Debian or Kali

In first, install the following dependences on your computer.

sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev wget libbz2-dev

And then, we can run the following command to install pyenv directly via APT on your computer.

sudo apt install pyenv

Or run the following command lines, to clone and install pyenv from its souce code.

git clone https://github.com/pyenv/pyenv.git ~/.pyenv;
 
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc;
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc;
echo 'eval "$(pyenv init --path)"' >> ~/.bashrc;
echo 'eval "$(pyenv init -)"' >> ~/.bashrc;
source ~/.bashrc;

Now, runing the following command line, we can use pyenv to install the version of Python what we want to install.

pyenv install 3.10.18;  # Here, we install Python 3.10.18.
sudo ln -s $HOME/.pyenv/versions/3.10.18/bin/python3 /usr/local/bin/python3.10

Project dependences

  1. sudo apt install cmake python3-venv Install Cmake and Virtual env;
  2. python3 -m venv .venv create a virtual env into directory named env;
  3. source .venv/bin/activate activate the virtual environment named .venv;
  4. make install install the requirements of this package;
  5. make dev_install or pip install -e . install the package in dev mode in virtual environment;
  6. Run make test or pytest to execute the unit test scripts located at tests directory.

For Windows

git clone https://github.com/cacybernetic/CVA_NET
cd CVA_NET

And then, delete the hidden directory named .git located at the root of the directory project.

And then,

  1. Install python for windows;
  2. Open your command prompt;
  3. Run python -m venv .venv to create a virtual env into directory named .venv;
  4. Run .venv\Scripts\activate to activate the virtual environment;
  5. Run pip install -r requirements.txt to install the requirements of this package or project;
  6. Run pip install -e . install the package in dev mode in virtual environment;
  7. pytest run the unit test scripts located at tests directory.

Quick Start

from cva_net import CVATrainer
from cva_net.models import ResNetClassifier
from cva_net.datasets import ImageFolderDataset

# Initialize dataset
dataset = ImageFolderDataset(
    data_dir="./data/train",
    image_size=(224, 224),
    augment=True
)

# Initialize model
model = ResNetClassifier(
    num_classes=10,
    backbone="resnet50",
    pretrained=True
)

# Setup trainer
trainer = CVATrainer(
    model=model,
    train_dataset=dataset,
    epochs=50,
    batch_size=32,
    learning_rate=0.001
)

# Start training
trainer.train()

# Evaluate model
metrics = trainer.evaluate()
print(f"Validation Accuracy: {metrics['accuracy']:.2f}%")

Usage Examples

Object Detection

from cva_net import DetectionTrainer
from cva_net.models import FasterRCNN

model = FasterRCNN(
    num_classes=80,
    backbone="resnet50",
    pretrained_backbone=True
)

trainer = DetectionTrainer(model=model)
trainer.setup_training(
    coco_annotation_path="./annotations/instances_train2017.json",
    image_dir="./train2017"
)
trainer.train(epochs=100)

Custom Training Pipeline

from cva_net import TrainingConfig
from cva_net.trainers import create_trainer

config = TrainingConfig(
    model_name="efficientnet_b0",
    task="classification",
    num_classes=1000,
    batch_size=64,
    learning_rate=0.01,
    epochs=100,
    mixed_precision=True
)

trainer = create_trainer(config)
trainer.fit()
trainer.export_model("my_model.onnx")

Supported Models

Classification

  • ResNet, ResNeXt
  • EfficientNet, EfficientNetV2
  • Vision Transformers (ViT, DeiT)
  • MobileNet, ShuffleNet

Detection

  • Faster R-CNN
  • YOLO (v5, v8, v11)
  • SSD
  • RetinaNet

Segmentation

  • Mask R-CNN
  • U-Net
  • DeepLab
  • FCN

Advanced Architectures

  • Swin Transformers
  • DETR
  • ConvNeXt
  • MLP-Mixer

Tests

Run the test suite to verify installation:

# Run all tests
make test

Contributing

We welcome contributions from the community! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch:
    git checkout -b feature/amazing-feature
  3. Commit your changes:
    git commit -m 'Add amazing feature'
  4. Push to the branch:
    git push origin feature/amazing-feature
  5. Open a Pull Request

Development Setup

make dev_install    # Install development dependencies
make lint           # Run code formatting
make type-check     # Run static type checking

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contact

For questions, suggestions, or support:


Start building intelligent vision systems today! 🚀

About

This repository contents different scripts for different models of neuron networks to allow you to train a model of image processing (classification, segmentation, object detection, image embedding etc).

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published