SVM-VGG Image Classifier

A hybrid SVM model using VGG-based CNN features for image classification of 28 chart/scientific diagram types.

Usage

from huggingface_hub import hf_hub_download
import joblib
import torch
from torchvision.models import vgg16
from PIL import Image
import numpy as np

# Load model
model_path = hf_hub_download(repo_id="ApostolosK/svm-vgg-model", filename="model.pkl")
svm_model = joblib.load(model_path)

# Load label names
labels = [...]  # Load from labels.json

vgg_model = vgg16(pretrained=True)
fc_cnn_model = vgg_model.classifier[:-2] 
def extract_features(image_path):
    return combined_features

# Make prediction
image = Image.open("your-image.png")
features = extract_features(image)
prediction = svm_model.predict([features])[0]
print(labels[prediction])
Downloads last month
27
Inference Providers NEW
This model is not currently available via any of the supported Inference Providers.
The model cannot be deployed to the HF Inference API: The model has no library tag.