Commit
·
df3bc94
1
Parent(s):
2f5085e
Moved to HF
Browse files- README.md +21 -8
- requirements.txt +1 -1
- src/app.py +0 -3
- src/utils.py +4 -4
README.md
CHANGED
@@ -1,18 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
# albumentations-demo
|
2 |
|
3 |
This service is created to demonstrate abilities of the [Albumentations](https://github.com/albumentations-team/albumentations) - a library for efficient image augmentations.
|
4 |
-
[Link to my article about augmentations selection and why this service can be useful](https://towardsdatascience.com/explore-image-augmentations-using-a-convenient-tool-a199b4ac8214)
|
5 |
-
|
6 |
-
## Easy start
|
7 |
-
I don't actively support this tool anymore but you can run it locally or use one of the deployed instances.
|
8 |
|
9 |
-
|
10 |
|
11 |
-
|
12 |
|
13 |
-
|
14 |
|
15 |
-
|
|
|
16 |
|
17 |
## Installation and run
|
18 |
```
|
|
|
1 |
+
---
|
2 |
+
title: Albumentations Demo
|
3 |
+
emoji: 🏢
|
4 |
+
colorFrom: blue
|
5 |
+
colorTo: pink
|
6 |
+
sdk: streamlit
|
7 |
+
sdk_version: 1.22.0
|
8 |
+
app_file: "src/app.py"
|
9 |
+
pinned: true
|
10 |
+
license: mit
|
11 |
+
short_description: "Optimize image augmentations with Albumentations"
|
12 |
+
tags: ["Computer Vision", "Image Augmentation", "Albumentations", "Streamlit", "Image Processing", "CV", "Image", "Augmentation"]
|
13 |
+
---
|
14 |
+
|
15 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
16 |
+
|
17 |
# albumentations-demo
|
18 |
|
19 |
This service is created to demonstrate abilities of the [Albumentations](https://github.com/albumentations-team/albumentations) - a library for efficient image augmentations.
|
|
|
|
|
|
|
|
|
20 |
|
21 |
+
[Link to my article about augmentations selection and why this service can be useful](https://towardsdatascience.com/explore-image-augmentations-using-a-convenient-tool-a199b4ac8214)
|
22 |
|
23 |
+
Project repository: [github.com/IliaLarchenko/albumentations-demo](https://github.com/IliaLarchenko/albumentations-demo)
|
24 |
|
25 |
+
Online demo: [huggingface.co/spaces/IliaLarchenko/albumentations-demo](https://huggingface.co/spaces/IliaLarchenko/albumentations-demo)
|
26 |
|
27 |
+
## Easy start
|
28 |
+
If you would like to run the service locally follow the installation instruction.
|
29 |
|
30 |
## Installation and run
|
31 |
```
|
requirements.txt
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
albumentations==0.4.3
|
2 |
altair==4.0
|
3 |
-
streamlit==1.
|
|
|
1 |
albumentations==0.4.3
|
2 |
altair==4.0
|
3 |
+
streamlit==1.22.0
|
src/app.py
CHANGED
@@ -68,9 +68,6 @@ def main():
|
|
68 |
# show title
|
69 |
st.title("Demo of Albumentations")
|
70 |
|
71 |
-
st.write("I have deployed this service as a Hugging Face Space: https://huggingface.co/spaces/ilarchenko/albumentations-demo please, check it out!")
|
72 |
-
st.write("The version deployed here on Heroku will be deprecated soon.")
|
73 |
-
|
74 |
# show the images
|
75 |
width_transformed = int(
|
76 |
width_original / image.shape[1] * augmented_image.shape[1]
|
|
|
68 |
# show title
|
69 |
st.title("Demo of Albumentations")
|
70 |
|
|
|
|
|
|
|
71 |
# show the images
|
72 |
width_transformed = int(
|
73 |
width_original / image.shape[1] * augmented_image.shape[1]
|
src/utils.py
CHANGED
@@ -7,7 +7,7 @@ import argparse
|
|
7 |
import streamlit as st
|
8 |
|
9 |
|
10 |
-
@st.
|
11 |
def get_arguments():
|
12 |
"""Return the values of CLI params"""
|
13 |
parser = argparse.ArgumentParser()
|
@@ -17,7 +17,7 @@ def get_arguments():
|
|
17 |
return getattr(args, "image_folder"), getattr(args, "image_width")
|
18 |
|
19 |
|
20 |
-
@st.
|
21 |
def get_images_list(path_to_folder: str) -> list:
|
22 |
"""Return the list of images from folder
|
23 |
Args:
|
@@ -29,7 +29,7 @@ def get_images_list(path_to_folder: str) -> list:
|
|
29 |
return image_names_list
|
30 |
|
31 |
|
32 |
-
@st.
|
33 |
def load_image(image_name: str, path_to_folder: str, bgr2rgb: bool = True):
|
34 |
"""Load the image
|
35 |
Args:
|
@@ -58,7 +58,7 @@ def upload_image(bgr2rgb: bool = True):
|
|
58 |
return image
|
59 |
|
60 |
|
61 |
-
@st.
|
62 |
def load_augmentations_config(
|
63 |
placeholder_params: dict, path_to_config: str = "configs/augmentations.json"
|
64 |
) -> dict:
|
|
|
7 |
import streamlit as st
|
8 |
|
9 |
|
10 |
+
@st.cache_data
|
11 |
def get_arguments():
|
12 |
"""Return the values of CLI params"""
|
13 |
parser = argparse.ArgumentParser()
|
|
|
17 |
return getattr(args, "image_folder"), getattr(args, "image_width")
|
18 |
|
19 |
|
20 |
+
@st.cache_data
|
21 |
def get_images_list(path_to_folder: str) -> list:
|
22 |
"""Return the list of images from folder
|
23 |
Args:
|
|
|
29 |
return image_names_list
|
30 |
|
31 |
|
32 |
+
@st.cache_data
|
33 |
def load_image(image_name: str, path_to_folder: str, bgr2rgb: bool = True):
|
34 |
"""Load the image
|
35 |
Args:
|
|
|
58 |
return image
|
59 |
|
60 |
|
61 |
+
@st.cache_data
|
62 |
def load_augmentations_config(
|
63 |
placeholder_params: dict, path_to_config: str = "configs/augmentations.json"
|
64 |
) -> dict:
|