ArcoAI
ArcoAI is a Python library designed for building artificial neural networks (ANNs) and convolutional neural networks (CNNs) with ease. It provides tools for quick and flexible model creation and visualization, streamlining the development process for both beginners and experienced practitioners in deep learning. It also integrates state-of-the-art model interpretability techniques like Grad-CAM, SmoothGrad, and Integrated Gradients.
Installation
1. Clone the repository
Go ahed and download ArcoAI through PIP.
pip install arcoai
2. Create a virtual environment (Just do it pls)
To avoid conflicts with other packages, you can create a virtual environment for this project.
python3 -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`
3. Install dependencies
Use pip to install all required dependencies listed in requirements.txt.
# Might not work for tensorflow, if not just install by itself
pip install -r requirements.txt
Getting Started
Once the package is installed, you can begin creating and training your own neural networks with just a few lines of code. Below are basic steps to get started with creating an ANN and CNN.
Example - Create and Train an ANN
from arcoai.models import ANN
from arcoai.datasets import load_dataset
# Load dataset (e.g., MNIST)
train_data, test_data = load_dataset('mnist')
# Initialize ANN model
model = ANN(input_size=784, hidden_layers=[128, 64], output_size=10)
# Compile model
model.compile(optimizer='adam', loss='categorical_crossentropy', metrics=['accuracy'])
# Train the model
model.train(train_data, epochs=10)
# Evaluate the model
accuracy = model.evaluate(test_data)
print(f"Test Accuracy: {accuracy}%")
Example - Create and Train a CNN
from arcoai.models import CNN
from arcoai.datasets import load_dataset
# Load dataset (e.g., CIFAR-10)
train_data, test_data = load_dataset('cifar10')
# Initialize CNN model
model = CNN(input_shape=(32, 32, 3), num_classes=10)
# Compile model
model.compile(optimizer='adam', loss='categorical_crossentropy', metrics=['accuracy'])
# Train the model
model.train(train_data, epochs=10)
# Evaluate the model
accuracy = model.evaluate(test_data)
print(f"Test Accuracy: {accuracy}%")
Model Architectures
ArcoAI includes several pre-built architectures for quick experimentation with different types of models.
1. DenseNet
DenseNet is a CNN architecture where each layer receives input from all previous layers. It's known for its high accuracy and efficiency in terms of parameters.
2. ResNet
ResNet (Residual Network) is a deep CNN that uses skip connections, enabling the training of very deep models. This helps mitigate vanishing gradients.
3. VGG
VGG is a CNN that consists of very deep layers with small 3x3 convolution filters. This architecture is popular for image classification tasks.
You can easily import and use these models from the arcoai.models package:
from arcoai.models import ResNet, VGG, DenseNet
Visualization Tools
ArcoAI comes with several powerful model interpretation tools (from Arcoson's gradientvis), which help visualize and understand the predictions made by your models.
1. Grad-CAM
Grad-CAM (Gradient-weighted Class Activation Mapping) helps visualize which regions of an image were important for the model's prediction.
from arcoai.visualization import GradCAM
# Initialize GradCAM
gradcam = GradCAM(model, target_class=0)
# Generate heatmap
heatmap = gradcam.generate_heatmap(input_image)
gradcam.show_heatmap(heatmap)
2. SmoothGrad
SmoothGrad is a technique to visualize the importance of different parts of an image by generating multiple noisy versions of the image.
from arcoai.visualization import SmoothGrad
# Initialize SmoothGrad
smoothgrad = SmoothGrad(model)
# Generate noise-based visualization
visualization = smoothgrad.generate_visualization(input_image)
smoothgrad.show_visualization(visualization)
3. Integrated Gradients
Integrated Gradients is a method that provides insights into the parts of an image that most influence the model's predictions.
from arcoai.visualization import IntegratedGradients
# Initialize IntegratedGradients
integrated_gradients = IntegratedGradients(model)
# Compute attributions
attributions = integrated_gradients.compute_attributions(input_image)
integrated_gradients.show_attributions(attributions)
Examples
You can find example scripts for both ANN and CNN in the examples/ directory. These examples include basic training routines for MNIST, CIFAR-10, and other datasets.
To run an example:
python examples/example_ann.py
python examples/example_cnn.py
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for arcoai 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| arcoai-0.1.1.tar.gz | 13.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| arcoai-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 26.9 kB
Release files / arcoai-0.1.1.tar.gz
| Download URL | arcoai-0.1.1.tar.gz |
|---|---|
| Size | 13.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8e454f7902fe52e2af2e42fdf55d7e8f5711d97bf345396c8722b418e95d0646
|
|
BLAKE2b-256 checksum How to use checksums |
ca5c975c8ca2dc74abbd1ad6f813be6522595409b7e8aa4a5b95ce0cdbcd7250
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Release files / arcoai-0.1.1-py3-none-any.whl
| Download URL | arcoai-0.1.1-py3-none-any.whl |
|---|---|
| Size | 13.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e64b252353f95fcbf247f6da858c25fd7ac2dfdb3f8dfeee27718b4aa9d1200a
|
|
BLAKE2b-256 checksum How to use checksums |
e620e9336f660a8aab0583f29816884b4cb1ee996741cd7e67ef1602ab892678
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|