YAML Metadata
Warning:
The pipeline tag "image-regression" is not in the official list: text-classification, token-classification, table-question-answering, question-answering, zero-shot-classification, translation, summarization, feature-extraction, text-generation, fill-mask, sentence-similarity, text-to-speech, text-to-audio, automatic-speech-recognition, audio-to-audio, audio-classification, audio-text-to-text, voice-activity-detection, depth-estimation, image-classification, object-detection, image-segmentation, text-to-image, image-to-text, image-to-image, image-to-video, unconditional-image-generation, video-classification, reinforcement-learning, robotics, tabular-classification, tabular-regression, tabular-to-text, table-to-text, multiple-choice, text-ranking, text-retrieval, time-series-forecasting, text-to-video, image-text-to-text, image-text-to-image, image-text-to-video, visual-question-answering, document-question-answering, zero-shot-image-classification, graph-ml, mask-generation, zero-shot-object-detection, text-to-3d, image-to-3d, image-feature-extraction, video-text-to-text, keypoint-detection, visual-document-retrieval, any-to-any, video-to-video, other
Visionary-Net
AI-Powered Refractive Error Estimation
Visionary-Net is a deep learning model that acts as a "Neural Auto-Refractor." It analyzes blur patterns in an image to estimate the optical prescription needed to correct them.
β‘ Model Specs
- Backbone: EfficientNet-B0
- Input: 224x224 RGB Image
- Output: Sphere (SPH), Cylinder (CYL), Axis (Sin/Cos)
- Best Checkpoint:
model_v1_ep9.pth(Included in repo)
π» How to Use
You need timm, torch, and opencv-python.
import torch
import torch.nn as nn
import timm
import cv2
import numpy as np
from huggingface_hub import hf_hub_download
# 1. Define Architecture
class VisionaryNet(nn.Module):
def __init__(self):
super().__init__()
self.backbone = timm.create_model('efficientnet_b0', pretrained=False, num_classes=0)
self.head = nn.Sequential(
nn.Linear(1280, 512), nn.ReLU(), nn.Dropout(0.2), nn.Linear(512, 4)
)
def forward(self, x):
return self.head(self.backbone(x))
# 2. Load the Best Checkpoint (Epoch 9)
model_path = hf_hub_download(repo_id="sanskxr02/Visionary-Net", filename="model_v1_ep9.pth")
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model = VisionaryNet().to(device)
model.load_state_dict(torch.load(model_path, map_location=device))
model.eval()
# 3. Predict on an Image
img = cv2.imread("test_blur.jpg") # Load image
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) # Convert to RGB
img = cv2.resize(img, (224, 224)) / 255.0 # Resize & Normalize
img_t = torch.from_numpy(img).permute(2, 0, 1).unsqueeze(0).float().to(device)
with torch.no_grad():
preds = model(img_t)[0].cpu().numpy()
sph, cyl, sin_a, cos_a = preds
axis = np.degrees(np.arctan2(sin_a, cos_a)) / 2.0
if axis < 0: axis += 180
print(f"ποΈ Prescription: SPH {sph:.2f} D | CYL {cyl:.2f} D | AXIS {axis:.0f}Β°")
- Downloads last month
- -
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
π
Ask for provider support