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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e03cc1637837765dacc2cb7f12dbc8d327fc2db894559a12361a4c133bd0309a
|
|
| MD5 |
902a0740cfa8e195af67cdb070378176
|
|
| BLAKE2b-256 |
7988a9885467b5475e340341f57d6fc1e4ace7de27e1734d081c82776dac799f
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1762aa905e23c6a2b255e4380a88e3053ce2d60b46cc27c1707b0cdfa78e00cb
|
|
| MD5 |
6e29bbedc1c31190ca0282dd13190c3b
|
|
| BLAKE2b-256 |
9b1b30edd1d246a5b8a7919d5b640b251283e7285091b4a99188bf6eef1de727
|