Skip to main content

Usage example: from OptiVisionNet.model import CNN_BiLSTM_MLP

Project description

OptiVisionNet

OptiVisionNet is a hybrid deep learning model designed for image classification tasks. It combines Convolutional Neural Networks (CNN), Bidirectional Long Short-Term Memory (BiLSTM), and Multi-Layer Perceptrons (MLP) to achieve high performance on various image classification datasets.

Installation

To install OptiVisionNet, use pip:

pip install OptiVisionNet

Usage

from OptiVisionNet.model import CNN_BiLSTM_MLP from OptiVisionNet.utils import train_cnn_bilstm, evaluate_model from torchvision import datasets, transforms from torch.utils.data import DataLoader import torch.optim as optim import torch.nn as nn

Data Preparation

transform = transforms.Compose([ transforms.ToTensor(), transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5)) ])

train_data = datasets.CIFAR10(root="data", train=True, download=True, transform=transform) test_data = datasets.CIFAR10(root="data", train=False, download=True, transform=transform)

train_loader = DataLoader(train_data, batch_size=64, shuffle=True) test_loader = DataLoader(test_data, batch_size=64, shuffle=False)

Initialize Model

model = CNN_BiLSTM_MLP(input_channels=3, lstm_hidden_size=128, lstm_layers=2, output_size=10)

Train CNN + BiLSTM

criterion = nn.CrossEntropyLoss() optimizer = optim.Adam(model.parameters(), lr=0.001) train_cnn_bilstm(model, train_loader, criterion, optimizer, epochs=5)

Evaluate the Model

accuracy, f1 = evaluate_model(model, test_loader) print(f"Test Accuracy: {accuracy:.2f}%") print(f"Test F1 Score: {f1:.2f}")

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

OptiVisionNet-0.3.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

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

OptiVisionNet-0.3.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file OptiVisionNet-0.3.0.tar.gz.

File metadata

  • Download URL: OptiVisionNet-0.3.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.9

File hashes

Hashes for OptiVisionNet-0.3.0.tar.gz
Algorithm Hash digest
SHA256 e03cc1637837765dacc2cb7f12dbc8d327fc2db894559a12361a4c133bd0309a
MD5 902a0740cfa8e195af67cdb070378176
BLAKE2b-256 7988a9885467b5475e340341f57d6fc1e4ace7de27e1734d081c82776dac799f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: OptiVisionNet-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.9

File hashes

Hashes for OptiVisionNet-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1762aa905e23c6a2b255e4380a88e3053ce2d60b46cc27c1707b0cdfa78e00cb
MD5 6e29bbedc1c31190ca0282dd13190c3b
BLAKE2b-256 9b1b30edd1d246a5b8a7919d5b640b251283e7285091b4a99188bf6eef1de727

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