prithivMLmods commited on
Commit
a85aaba
·
verified ·
1 Parent(s): 9e0eccc

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +88 -1
README.md CHANGED
@@ -3,7 +3,20 @@ license: apache-2.0
3
  datasets:
4
  - prithivMLmods/IndoorOutdoorNet-20K
5
  library_name: transformers
 
 
 
 
 
 
 
 
 
 
6
  ---
 
 
 
7
 
8
  ```py
9
  Classification Report:
@@ -17,4 +30,78 @@ Classification Report:
17
  weighted avg 0.9610 0.9609 0.9609 19998
18
  ```
19
 
20
- ![download (1).png](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/wLvX04YPoU2OsDjKBDKXU.png)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  datasets:
4
  - prithivMLmods/IndoorOutdoorNet-20K
5
  library_name: transformers
6
+ language:
7
+ - en
8
+ base_model:
9
+ - google/siglip2-base-patch16-224
10
+ pipeline_tag: image-classification
11
+ tags:
12
+ - Indoor
13
+ - Outdoor
14
+ - Classification
15
+ - SigLIP2
16
  ---
17
+ # **IndoorOutdoorNet**
18
+
19
+ > **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.
20
 
21
  ```py
22
  Classification Report:
 
30
  weighted avg 0.9610 0.9609 0.9609 19998
31
  ```
32
 
33
+ ![download (1).png](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/wLvX04YPoU2OsDjKBDKXU.png)
34
+
35
+
36
+ ---
37
+
38
+ The model categorizes images into 2 environment-related classes:
39
+
40
+ ```
41
+ Class 0: "Indoor"
42
+ Class 1: "Outdoor"
43
+ ```
44
+
45
+ ---
46
+
47
+ ## **Install dependencies**
48
+
49
+ ```python
50
+ !pip install -q transformers torch pillow gradio
51
+ ```
52
+
53
+ ---
54
+
55
+ ## **Inference Code**
56
+
57
+ ```python
58
+ import gradio as gr
59
+ from transformers import AutoImageProcessor, SiglipForImageClassification
60
+ from PIL import Image
61
+ import torch
62
+
63
+ # Load model and processor
64
+ model_name = "prithivMLmods/IndoorOutdoorNet" # Updated model name
65
+ model = SiglipForImageClassification.from_pretrained(model_name)
66
+ processor = AutoImageProcessor.from_pretrained(model_name)
67
+
68
+ def classify_environment_image(image):
69
+ """Predicts whether an image is Indoor or Outdoor."""
70
+ image = Image.fromarray(image).convert("RGB")
71
+ inputs = processor(images=image, return_tensors="pt")
72
+
73
+ with torch.no_grad():
74
+ outputs = model(**inputs)
75
+ logits = outputs.logits
76
+ probs = torch.nn.functional.softmax(logits, dim=1).squeeze().tolist()
77
+
78
+ labels = {
79
+ "0": "Indoor", "1": "Outdoor"
80
+ }
81
+ predictions = {labels[str(i)]: round(probs[i], 3) for i in range(len(probs))}
82
+
83
+ return predictions
84
+
85
+ # Create Gradio interface
86
+ iface = gr.Interface(
87
+ fn=classify_environment_image,
88
+ inputs=gr.Image(type="numpy"),
89
+ outputs=gr.Label(label="Prediction Scores"),
90
+ title="IndoorOutdoorNet",
91
+ description="Upload an image to classify it as Indoor or Outdoor."
92
+ )
93
+
94
+ if __name__ == "__main__":
95
+ iface.launch()
96
+ ```
97
+
98
+ ---
99
+
100
+ ## **Intended Use:**
101
+
102
+ The **IndoorOutdoorNet** model is designed to classify images into indoor or outdoor environments. Potential use cases include:
103
+
104
+ - **Smart Cameras:** Detect indoor/outdoor context to adjust settings.
105
+ - **Dataset Curation:** Automatically filter image datasets by setting.
106
+ - **Robotics & Drones:** Environment-aware navigation logic.
107
+ - **Content Filtering:** Moderate or tag environment context in image platforms.