Skip to main content

A framework for managing deep learning projects

Project description

NeuroStage

"NeuroStage is a framework that allows users to create and manage deep learning projects in a structured and modular way, adapted for TensorFlow. It includes integration with tools like Tensorboard, enabling users to efficiently track and improve their models."

Purpose

NeuroStage was born from the idea of automatically generating projects, with a specific focus on building deep learning models using TensorFlow. It is a tool designed for new users who need a standard structure without having to worry about organizing the project from scratch.

Índice

  1. Design
  2. Features
  3. Installation
  4. Usage Flow

Design

It is designed as a layer-based pattern (for building modules, architectures, and training) which is excellent for organizing a TensorFlow framework for deep learning testing. This modular approach facilitates integration with TensorBoard and promotes scalability.

Modules

Layers Define base layers here (e.g., convolutional, attention, etc.) that can be used in models. These layers form the building blocks for your deep learning models.

Models Combine the layers to create specific architectures for evaluation. This module allows you to design and implement various deep learning models by reusing and combining different layers.

Training Conduct experiments with specific configurations, logging metrics, parameters, and artifacts. This module focuses on the training process, helping you to configure and run training sessions, and track the performance and results.

Features

Feature DeepTrain
Model Management Allows customization for versioning and saving models.
Test Automation Executes each training session in series as defined by the training module.
Tool Compatibility TensorFlow, TensorBoard
Open Source MIT License
Flexibility Preconfigured but flexible, define rules and processes as per your case
Collaboration Avalable

Project Structure

my_project/
│
├── config.py             # Project configuration file
├── utils.py              # General utilities file
├── functions.py          # Training functions file
├── imports.py            # Library imports file
├── experiments/          # Folder for experiments
└── src/                  # Main source code folder
    ├── layers/           # Folder for implementing custom layers
    │   └── layer_a.py    # Example content
    │   └── layer_b.py 
    ├── models/           # Folder for defining models
    │   └── model_a.py    # Example content
    │   └── model_b.py 
    └── training/         # Folder for compiling and starting training
        └── train_a.py    # Example content
        └── train_b.py

Installation

To install NeuroStage, simply run the following command:

pip install neurostage

For more detailed information, visit the project page on Github: NeuroStage

Usage-Flow

Start a new project

stage startproject my_project

create a new layer

File: src/layers/layer_custom.py

from imports import tf

class CustomLayer(tf.keras.layers.Layer):
    def __init__(self, units, **kwargs):
        super().__init__(**kwargs)
        self.units = units
        self.dense = tf.keras.layers.Dense(units)

    def call(self, inputs):
        return self.dense(inputs)

create a new model

File: src/models/model_custom.py

from imports import tf
from src.layers.layer_custom import CustomLayer

class ModelCustom():
    def __init__(self): 
        super(Model, self).__init__() 
        self.layer = CustomLayer(64)


    def build_model(self, input):
        x = self.layer(input)
        x = self.layer(x)
        x = self.layer(x)

        model = tf.keras.Model(inputs=input, outputs=x)

        return model

Create a training runner

File: src/training/train_custom.py

from functions import NeuroStage
from imports import tf, np
from src.models.model import Model

class TrainModel(NeuroStage):
    def __init__(self, batch_size=32, epochs=4, model_name='', models=None):
        super().__init__()

        self.BATCH_SIZE = batch_size
        self.EPHOCS = epochs
        self.MODEL_NAME = model_name

        input = tf.keras.Input(shape=(256, 256, 1))  
        self.optimizer = tf.keras.optimizers.SGD(learning_rate=1e-3, momentum=0.95)
        self.architecture = Model()
        print(models)
        self.model = self.architecture.build_model(input)
        self.model.compile(optimizer=self.optimizer,
                         loss='binary_crossentropy',
                         metrics=['accuracy'])

    def train(self):
        X_train = np.random.rand(100, 256, 256, 1)
        y_train = np.random.randint(0, 2, 100) 
        X_val = np.random.rand(20, 256, 256, 1) 
        y_val = np.random.randint(0, 2, 20)

        self.init_fit(self.model, X_train, y_train, X_val, y_val, self.EPHOCS, self.BATCH_SIZE, self.MODEL_NAME)

Execution

stage run --batch_size 32 --epochs 10 --model_name my_model

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

neurostage-0.1.1.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

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

neurostage-0.1.1-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file neurostage-0.1.1.tar.gz.

File metadata

  • Download URL: neurostage-0.1.1.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.8.20

File hashes

Hashes for neurostage-0.1.1.tar.gz
Algorithm Hash digest
SHA256 3ecc13f65514dd70072cc252451b457ed9c2d6fd9426bf6f0b5c92c33bab459c
MD5 c94e408bcc185d8049fa8ec69300c43e
BLAKE2b-256 f125eea3e5095b4da39de86e2846035fe2dab04651fe8283c034fb3265d34b11

See more details on using hashes here.

File details

Details for the file neurostage-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: neurostage-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.8.20

File hashes

Hashes for neurostage-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 63d6d0b0cc2f6797c28525e083fbc71558dd0cded3dd5fa3c2a31ad5cbc48acb
MD5 3e8e9266f913d9d45e466308a869e70b
BLAKE2b-256 b566c179a9213913a6dfaa67cdf11d1e51bb0646b7f380312de987d0b0028e84

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