prithivMLmods/IndoorOutdoorNet
366
1---2license: apache-2.03datasets:4- prithivMLmods/IndoorOutdoorNet-20K5library_name: transformers6language:7- en8base_model:9- google/siglip2-base-patch16-22410pipeline_tag: image-classification11tags:12- Indoor13- Outdoor14- Classification15- SigLIP216---17 1819 20# **IndoorOutdoorNet**21 22> **IndoorOutdoorNet** is an image classification vision-language encoder model fine-tuned from **google/siglip2-base-patch16-224** for a single-label classification task. It is designed to classify images as either **Indoor** or **Outdoor** using the **SiglipForImageClassification** architecture.23 24```py25Classification Report:26 precision recall f1-score support27 28 Indoor 0.9661 0.9554 0.9607 999929 Outdoor 0.9559 0.9665 0.9612 999930 31 accuracy 0.9609 1999832 macro avg 0.9610 0.9609 0.9609 1999833weighted avg 0.9610 0.9609 0.9609 1999834```35 3637 38 39---40 41The model categorizes images into 2 environment-related classes:42 43```44 Class 0: "Indoor"45 Class 1: "Outdoor"46```47 48---49 50## **Install dependencies**51 52```python53!pip install -q transformers torch pillow gradio54```55 56---57 58## **Inference Code**59 60```python61import gradio as gr62from transformers import AutoImageProcessor, SiglipForImageClassification63from PIL import Image64import torch65 66# Load model and processor67model_name = "prithivMLmods/IndoorOutdoorNet" # Updated model name68model = SiglipForImageClassification.from_pretrained(model_name)69processor = AutoImageProcessor.from_pretrained(model_name)70 71def classify_environment_image(image):72 """Predicts whether an image is Indoor or Outdoor."""73 image = Image.fromarray(image).convert("RGB")74 inputs = processor(images=image, return_tensors="pt")75 76 with torch.no_grad():77 outputs = model(**inputs)78 logits = outputs.logits79 probs = torch.nn.functional.softmax(logits, dim=1).squeeze().tolist()80 81 labels = {82 "0": "Indoor", "1": "Outdoor"83 }84 predictions = {labels[str(i)]: round(probs[i], 3) for i in range(len(probs))}85 86 return predictions87 88# Create Gradio interface89iface = gr.Interface(90 fn=classify_environment_image,91 inputs=gr.Image(type="numpy"),92 outputs=gr.Label(label="Prediction Scores"),93 title="IndoorOutdoorNet",94 description="Upload an image to classify it as Indoor or Outdoor."95)96 97if __name__ == "__main__":98 iface.launch()99```100 101---102 103## **Intended Use:**104 105The **IndoorOutdoorNet** model is designed to classify images into indoor or outdoor environments. Potential use cases include:106 107- **Smart Cameras:** Detect indoor/outdoor context to adjust settings.108- **Dataset Curation:** Automatically filter image datasets by setting.109- **Robotics & Drones:** Environment-aware navigation logic.110- **Content Filtering:** Moderate or tag environment context in image platforms. 