update README
Browse files
README.md
CHANGED
|
@@ -9,4 +9,31 @@ app_file: app.py
|
|
| 9 |
pinned: false
|
| 10 |
---
|
| 11 |
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
pinned: false
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# Generative Augmented Classifiers
|
| 13 |
+
|
| 14 |
+
Main GitHub Repo: [Generative Data Augmentation](https://github.com/zhulinchng/generative-data-augmentation) | Image Classification Demo: [Generative Augmented Classifiers](https://huggingface.co/spaces/czl/generative-augmented-classifiers).
|
| 15 |
+
|
| 16 |
+
This demo showcases the performance of image classifiers trained on various datasets as part of the project `Investigating the Effectiveness of Generative Diffusion Models in Synthesizing Images for Data Augmentation in Image Classification' dissertation.
|
| 17 |
+
|
| 18 |
+
## Demo Usage Instructions
|
| 19 |
+
|
| 20 |
+
1. Select the dataset, the model architecture, training methods, type of training dataset to evaluate the classifier on.
|
| 21 |
+
2. Upload an image, or click `Sample Random Image` to select a random image from the validation dataset.
|
| 22 |
+
3. Click `Classify` to classify the image using the selected classifier.
|
| 23 |
+
4. To download the classifier, click `Download Model: <model_name>`.
|
| 24 |
+
|
| 25 |
+
The top 5 predicted labels and their corresponding probabilities are displayed.
|
| 26 |
+
|
| 27 |
+
## Configuration
|
| 28 |
+
|
| 29 |
+
```bash
|
| 30 |
+
git clone https://huggingface.co/spaces/czl/generative-augmented-classifiers
|
| 31 |
+
cd generative-data-augmentation-demo
|
| 32 |
+
# Setup the data directory structure as shown above
|
| 33 |
+
conda create --name $env_name python=3.11.* # Replace $env_name with your environment name
|
| 34 |
+
conda activate $env_name
|
| 35 |
+
# Visit PyTorch website https://pytorch.org/get-started/previous-versions/#v212 for PyTorch installation instructions.
|
| 36 |
+
pip install torch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2 --index-url # Obtain the correct URL from the PyTorch website
|
| 37 |
+
pip install -r requirements.txt
|
| 38 |
+
python app.py
|
| 39 |
+
```
|
app.py
CHANGED
|
@@ -223,7 +223,9 @@ if __name__ == "__main__":
|
|
| 223 |
gr.Markdown(
|
| 224 |
"""
|
| 225 |
# Generative Augmented Image Classifiers
|
| 226 |
-
This demo showcases the performance of image classifiers trained on various datasets.
|
|
|
|
|
|
|
| 227 |
"""
|
| 228 |
)
|
| 229 |
with gr.Row():
|
|
@@ -266,9 +268,7 @@ This demo showcases the performance of image classifiers trained on various data
|
|
| 266 |
outputs=[training_ds],
|
| 267 |
)
|
| 268 |
generate_button = gr.Button("Sample Random Image")
|
| 269 |
-
random_image_output = gr.Image(
|
| 270 |
-
type="pil", label="Random Image from Validation Set"
|
| 271 |
-
)
|
| 272 |
classify_button_random = gr.Button("Classify")
|
| 273 |
with gr.Column():
|
| 274 |
output_label_random = gr.Label(num_top_classes=5)
|
|
|
|
| 223 |
gr.Markdown(
|
| 224 |
"""
|
| 225 |
# Generative Augmented Image Classifiers
|
| 226 |
+
This demo showcases the performance of image classifiers trained on various datasets as part of the project `Investigating the Effectiveness of Generative Diffusion Models in Synthesizing Images for Data Augmentation in Image Classification' dissertation.
|
| 227 |
+
|
| 228 |
+
Main GitHub Repo: [Generative Data Augmentation](https://github.com/zhulinchng/generative-data-augmentation) | Generative Data Augmentation Demo: [Generative Data Augmented](https://huggingface.co/spaces/czl/generative-data-augmentation-demo).
|
| 229 |
"""
|
| 230 |
)
|
| 231 |
with gr.Row():
|
|
|
|
| 268 |
outputs=[training_ds],
|
| 269 |
)
|
| 270 |
generate_button = gr.Button("Sample Random Image")
|
| 271 |
+
random_image_output = gr.Image(type="pil", label="Image to Classify")
|
|
|
|
|
|
|
| 272 |
classify_button_random = gr.Button("Classify")
|
| 273 |
with gr.Column():
|
| 274 |
output_label_random = gr.Label(num_top_classes=5)
|