christhegamechanger commited on
Commit
ba6a904
·
1 Parent(s): cac44f3

Delete Background_Removal_and_Change

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. Background_Removal_and_Change/.gitattributes +0 -27
  2. Background_Removal_and_Change/.idea/.gitignore +0 -8
  3. Background_Removal_and_Change/.idea/Background_Removal_and_Change.iml +0 -10
  4. Background_Removal_and_Change/.idea/deployment.xml +0 -14
  5. Background_Removal_and_Change/.idea/inspectionProfiles/Project_Default.xml +0 -27
  6. Background_Removal_and_Change/.idea/inspectionProfiles/profiles_settings.xml +0 -6
  7. Background_Removal_and_Change/.idea/misc.xml +0 -4
  8. Background_Removal_and_Change/.idea/modules.xml +0 -8
  9. Background_Removal_and_Change/.idea/sshConfigs.xml +0 -8
  10. Background_Removal_and_Change/.idea/vcs.xml +0 -9
  11. Background_Removal_and_Change/.idea/webServers.xml +0 -14
  12. Background_Removal_and_Change/Procfile +0 -1
  13. Background_Removal_and_Change/README.md +0 -9
  14. Background_Removal_and_Change/__pycache__/libs.cpython-38.pyc +0 -0
  15. Background_Removal_and_Change/__pycache__/libs.cpython-39.pyc +0 -0
  16. Background_Removal_and_Change/__pycache__/metrics.cpython-310.pyc +0 -0
  17. Background_Removal_and_Change/__pycache__/metrics.cpython-38.pyc +0 -0
  18. Background_Removal_and_Change/__pycache__/metrics.cpython-39.pyc +0 -0
  19. Background_Removal_and_Change/__pycache__/utils_func.cpython-38.pyc +0 -0
  20. Background_Removal_and_Change/__pycache__/utils_func.cpython-39.pyc +0 -0
  21. Background_Removal_and_Change/app.py +0 -94
  22. Background_Removal_and_Change/backgrounds/beach.jpg +0 -0
  23. Background_Removal_and_Change/backgrounds/camnou_stadium.jpg +0 -0
  24. Background_Removal_and_Change/backgrounds/office-bg.jpg +0 -0
  25. Background_Removal_and_Change/images/img8.jpg +0 -0
  26. Background_Removal_and_Change/images/messi.jpg +0 -0
  27. Background_Removal_and_Change/images/office.jpg +0 -0
  28. Background_Removal_and_Change/libs.py +0 -10
  29. Background_Removal_and_Change/metrics.py +0 -25
  30. Background_Removal_and_Change/remove_bg/R.jpg_1.png +0 -0
  31. Background_Removal_and_Change/remove_bg/R.jpg_2.png +0 -0
  32. Background_Removal_and_Change/remove_bg/R.jpg_3.png +0 -0
  33. Background_Removal_and_Change/remove_bg/R.jpg_4.png +0 -0
  34. Background_Removal_and_Change/remove_bg/R.jpg_5.png +0 -0
  35. Background_Removal_and_Change/remove_bg/R.jpg_6.png +0 -0
  36. Background_Removal_and_Change/remove_bg/beach.jpg_1.png +0 -0
  37. Background_Removal_and_Change/remove_bg/beach.jpg_2.png +0 -0
  38. Background_Removal_and_Change/remove_bg/beach.jpg_3.png +0 -0
  39. Background_Removal_and_Change/remove_bg/beach.jpg_4.png +0 -0
  40. Background_Removal_and_Change/remove_bg/beach.jpg_5.png +0 -0
  41. Background_Removal_and_Change/remove_bg/beach.jpg_6.png +0 -0
  42. Background_Removal_and_Change/remove_bg/messi.jpg_1.png +0 -0
  43. Background_Removal_and_Change/remove_bg/messi.jpg_2.png +0 -0
  44. Background_Removal_and_Change/remove_bg/messi.jpg_3.png +0 -0
  45. Background_Removal_and_Change/remove_bg/messi.jpg_4.png +0 -3
  46. Background_Removal_and_Change/remove_bg/messi.jpg_5.png +0 -3
  47. Background_Removal_and_Change/remove_bg/messi.jpg_6.png +0 -3
  48. Background_Removal_and_Change/requirements.txt +0 -0
  49. Background_Removal_and_Change/setup.sh +0 -13
  50. Background_Removal_and_Change/tempDir/R.jpg +0 -0
Background_Removal_and_Change/.gitattributes DELETED
@@ -1,27 +0,0 @@
1
- *.7z filter=lfs diff=lfs merge=lfs -text
2
- *.arrow filter=lfs diff=lfs merge=lfs -text
3
- *.bin filter=lfs diff=lfs merge=lfs -text
4
- *.bz2 filter=lfs diff=lfs merge=lfs -text
5
- *.ftz filter=lfs diff=lfs merge=lfs -text
6
- *.gz filter=lfs diff=lfs merge=lfs -text
7
- *.h5 filter=lfs diff=lfs merge=lfs -text
8
- *.joblib filter=lfs diff=lfs merge=lfs -text
9
- *.lfs.* filter=lfs diff=lfs merge=lfs -text
10
- *.model filter=lfs diff=lfs merge=lfs -text
11
- *.msgpack filter=lfs diff=lfs merge=lfs -text
12
- *.onnx filter=lfs diff=lfs merge=lfs -text
13
- *.ot filter=lfs diff=lfs merge=lfs -text
14
- *.parquet filter=lfs diff=lfs merge=lfs -text
15
- *.pb filter=lfs diff=lfs merge=lfs -text
16
- *.pt filter=lfs diff=lfs merge=lfs -text
17
- *.pth filter=lfs diff=lfs merge=lfs -text
18
- *.rar filter=lfs diff=lfs merge=lfs -text
19
- saved_model/**/* filter=lfs diff=lfs merge=lfs -text
20
- *.tar.* filter=lfs diff=lfs merge=lfs -text
21
- *.tflite filter=lfs diff=lfs merge=lfs -text
22
- *.tgz filter=lfs diff=lfs merge=lfs -text
23
- *.wasm filter=lfs diff=lfs merge=lfs -text
24
- *.xz filter=lfs diff=lfs merge=lfs -text
25
- *.zip filter=lfs diff=lfs merge=lfs -text
26
- *.zstandard filter=lfs diff=lfs merge=lfs -text
27
- *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Background_Removal_and_Change/.idea/.gitignore DELETED
@@ -1,8 +0,0 @@
1
- # Default ignored files
2
- /shelf/
3
- /workspace.xml
4
- # Editor-based HTTP Client requests
5
- /httpRequests/
6
- # Datasource local storage ignored files
7
- /dataSources/
8
- /dataSources.local.xml
 
 
 
 
 
 
 
 
 
Background_Removal_and_Change/.idea/Background_Removal_and_Change.iml DELETED
@@ -1,10 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="PYTHON_MODULE" version="4">
3
- <component name="NewModuleRootManager">
4
- <content url="file://$MODULE_DIR$">
5
- <excludeFolder url="file://$MODULE_DIR$/venvme" />
6
- </content>
7
- <orderEntry type="jdk" jdkName="Python 3.9 (pythonProject)" jdkType="Python SDK" />
8
- <orderEntry type="sourceFolder" forTests="false" />
9
- </component>
10
- </module>
 
 
 
 
 
 
 
 
 
 
 
Background_Removal_and_Change/.idea/deployment.xml DELETED
@@ -1,14 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="PublishConfigData" serverName="HAHALOLO_SERVER" remoteFilesAllowedToDisappearOnAutoupload="false">
4
- <serverData>
5
- <paths name="HAHALOLO_SERVER">
6
- <serverdata>
7
- <mappings>
8
- <mapping deploy="/text_censorship" local="$USER_HOME$/PycharmProjects/TextCensorship" web="/" />
9
- </mappings>
10
- </serverdata>
11
- </paths>
12
- </serverData>
13
- </component>
14
- </project>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Background_Removal_and_Change/.idea/inspectionProfiles/Project_Default.xml DELETED
@@ -1,27 +0,0 @@
1
- <component name="InspectionProjectProfileManager">
2
- <profile version="1.0">
3
- <option name="myName" value="Project Default" />
4
- <inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
5
- <option name="ignoredPackages">
6
- <value>
7
- <list size="14">
8
- <item index="0" class="java.lang.String" itemvalue="scipy" />
9
- <item index="1" class="java.lang.String" itemvalue="opencv-python" />
10
- <item index="2" class="java.lang.String" itemvalue="Pillow" />
11
- <item index="3" class="java.lang.String" itemvalue="pandas" />
12
- <item index="4" class="java.lang.String" itemvalue="datetime" />
13
- <item index="5" class="java.lang.String" itemvalue="tensorflow" />
14
- <item index="6" class="java.lang.String" itemvalue="retina-face" />
15
- <item index="7" class="java.lang.String" itemvalue="gdown" />
16
- <item index="8" class="java.lang.String" itemvalue="matplotlib" />
17
- <item index="9" class="java.lang.String" itemvalue="deepface" />
18
- <item index="10" class="java.lang.String" itemvalue="cmake" />
19
- <item index="11" class="java.lang.String" itemvalue="keras" />
20
- <item index="12" class="java.lang.String" itemvalue="requests" />
21
- <item index="13" class="java.lang.String" itemvalue="numpy" />
22
- </list>
23
- </value>
24
- </option>
25
- </inspection_tool>
26
- </profile>
27
- </component>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Background_Removal_and_Change/.idea/inspectionProfiles/profiles_settings.xml DELETED
@@ -1,6 +0,0 @@
1
- <component name="InspectionProjectProfileManager">
2
- <settings>
3
- <option name="USE_PROJECT_PROFILE" value="false" />
4
- <version value="1.0" />
5
- </settings>
6
- </component>
 
 
 
 
 
 
 
Background_Removal_and_Change/.idea/misc.xml DELETED
@@ -1,4 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (pythonProject)" project-jdk-type="Python SDK" />
4
- </project>
 
 
 
 
 
Background_Removal_and_Change/.idea/modules.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/Background_Removal_and_Change.iml" filepath="$PROJECT_DIR$/.idea/Background_Removal_and_Change.iml" />
6
- </modules>
7
- </component>
8
- </project>
 
 
 
 
 
 
 
 
 
Background_Removal_and_Change/.idea/sshConfigs.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="SshConfigs">
4
- <configs>
5
- <sshConfig authType="PASSWORD" host="10.10.15.87" id="8b67aa76-bd20-4263-bc45-270bf4ea8b6e" port="22" nameFormat="DESCRIPTIVE" username="root" useOpenSSHConfig="true" />
6
- </configs>
7
- </component>
8
- </project>
 
 
 
 
 
 
 
 
 
Background_Removal_and_Change/.idea/vcs.xml DELETED
@@ -1,9 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
- <mapping directory="$PROJECT_DIR$/Background_removal_and_change" vcs="Git" />
6
- <mapping directory="$PROJECT_DIR$/Remove-Photo-Background-using-TensorFlow" vcs="Git" />
7
- <mapping directory="$PROJECT_DIR$/yolov5" vcs="Git" />
8
- </component>
9
- </project>
 
 
 
 
 
 
 
 
 
 
Background_Removal_and_Change/.idea/webServers.xml DELETED
@@ -1,14 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="WebServers">
4
- <option name="servers">
5
- <webServer id="7c3f60f5-5354-4ef4-a283-182d579b3fe7" name="HAHALOLO_SERVER">
6
- <fileTransfer rootFolder="/storage/test" accessType="SFTP" host="10.10.15.87" port="22" sshConfigId="8b67aa76-bd20-4263-bc45-270bf4ea8b6e" sshConfig="[email protected]:22 password">
7
- <advancedOptions>
8
- <advancedOptions dataProtectionLevel="Private" keepAliveTimeout="0" passiveMode="true" shareSSLContext="true" isUseRsync="true" />
9
- </advancedOptions>
10
- </fileTransfer>
11
- </webServer>
12
- </option>
13
- </component>
14
- </project>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Background_Removal_and_Change/Procfile DELETED
@@ -1 +0,0 @@
1
- web: sh setup.sh && streamlit run app.py
 
 
Background_Removal_and_Change/README.md DELETED
@@ -1,9 +0,0 @@
1
- ---
2
- title: ABC- Automatic Background Change
3
- emoji: ⚡
4
- colorFrom: yellow
5
- colorTo: gray
6
- sdk: streamlit
7
- app_file: app.py
8
- pinned: false
9
- ---
 
 
 
 
 
 
 
 
 
 
Background_Removal_and_Change/__pycache__/libs.cpython-38.pyc DELETED
Binary file (431 Bytes)
 
Background_Removal_and_Change/__pycache__/libs.cpython-39.pyc DELETED
Binary file (408 Bytes)
 
Background_Removal_and_Change/__pycache__/metrics.cpython-310.pyc DELETED
Binary file (1.03 kB)
 
Background_Removal_and_Change/__pycache__/metrics.cpython-38.pyc DELETED
Binary file (998 Bytes)
 
Background_Removal_and_Change/__pycache__/metrics.cpython-39.pyc DELETED
Binary file (1.02 kB)
 
Background_Removal_and_Change/__pycache__/utils_func.cpython-38.pyc DELETED
Binary file (4.1 kB)
 
Background_Removal_and_Change/__pycache__/utils_func.cpython-39.pyc DELETED
Binary file (4.16 kB)
 
Background_Removal_and_Change/app.py DELETED
@@ -1,94 +0,0 @@
1
- from libs import *
2
- from utils_func import create_dir, main_processing
3
-
4
-
5
-
6
- create_dir("tempDir")
7
-
8
-
9
- def load_image(image_file):
10
- img = Image.open(image_file)
11
- return img
12
-
13
-
14
- def streamlit_app():
15
- detection_model_path = "weight_files/clothes_detection_model.pt"
16
- background_model_path = "weight_files/model.h5"
17
- save_path = ""
18
- image_file = None
19
- st.title("""WELCOME TO MY APP""")
20
- st.subheader("""FOR BACKGROUND REMOVAL AND CHANGE!""")
21
- col1 = None
22
- col2 = None
23
- final_img = None
24
- with st.spinner("[UPLOAD] Image uploading"):
25
- try:
26
- image_file = st.file_uploader('[UPLOAD] Please upload your image:', type=["png", "jpg", "jpeg"])
27
- time.sleep(1)
28
- except:
29
- print("[ERROR] Sorry, something went wrong!")
30
- pass
31
- # print(type(image_file))
32
-
33
- if image_file is not None:
34
- st.success("Load image successfully!...")
35
- image = load_image(image_file)
36
- # print(type(image))
37
- col1, col2, col3 = st.columns(3)
38
- with col1:
39
- st.image(image, caption="Image before processing")
40
- save_path = "tempDir/"+ image_file.name
41
- image.save(save_path)
42
-
43
-
44
- image_path, details = save_path, image_file
45
-
46
- if details is not None:
47
- with col2:
48
- with st.spinner("[PROCESSING] Image processing"):
49
- final_img_path = main_processing(col1, col2, col3, sport_bg_path=stadium_sport_bg_path, swim_bg_path=beach_swim_bg_path,
50
- office_bg_path=office_bg_path, img_path=image_path, name=details.name,
51
- detection_model_path=detection_model_path,
52
- background_model_path=background_model_path)
53
- time.sleep(1)
54
-
55
- with col1:
56
- if final_img_path is not None:
57
- final_img = load_image(final_img_path)
58
- st.image(final_img, caption="Image after processing")
59
- st.balloons()
60
- with col2:
61
- with open(final_img_path, "rb") as file:
62
- st.write('\n')
63
- st.write('\n')
64
- st.write('\n')
65
- st.write('\n')
66
- st.write('\n')
67
-
68
- file_name = save_path.split("/")[-1].split(".")[-2] +"_from_abc" + ".png"
69
-
70
- if st.download_button(
71
- label="Download postprocessing image",
72
- data=file,
73
- file_name= file_name,
74
- mime="image/png"
75
- ):
76
- st.success('[DOWNLOAD] Download sucessfully!')
77
-
78
-
79
-
80
- if __name__ == '__main__':
81
- np.random.seed(42)
82
- tf.random.set_seed(42)
83
-
84
- bg_path = ""
85
- background_model_path = "weight_files/model.h5"
86
- detection_model_path = "weight_files/clothes_detection_model.pt"
87
-
88
- stadium_sport_bg_path = "backgrounds/camnou_stadium.jpg"
89
- beach_swim_bg_path = "backgrounds/beach.jpg"
90
- office_bg_path = "backgrounds/office-bg.jpg"
91
-
92
- image_path = None
93
-
94
- streamlit_app()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Background_Removal_and_Change/backgrounds/beach.jpg DELETED
Binary file (75.3 kB)
 
Background_Removal_and_Change/backgrounds/camnou_stadium.jpg DELETED
Binary file (125 kB)
 
Background_Removal_and_Change/backgrounds/office-bg.jpg DELETED
Binary file (23.9 kB)
 
Background_Removal_and_Change/images/img8.jpg DELETED
Binary file (153 kB)
 
Background_Removal_and_Change/images/messi.jpg DELETED
Binary file (230 kB)
 
Background_Removal_and_Change/images/office.jpg DELETED
Binary file (50.7 kB)
 
Background_Removal_and_Change/libs.py DELETED
@@ -1,10 +0,0 @@
1
- import torch
2
- import json
3
- import os
4
- import numpy as np
5
- import cv2
6
- import tensorflow as tf
7
- import streamlit as st
8
- import time
9
- from PIL import Image
10
- from tensorflow.keras.utils import CustomObjectScope
 
 
 
 
 
 
 
 
 
 
 
Background_Removal_and_Change/metrics.py DELETED
@@ -1,25 +0,0 @@
1
- from libs import *
2
-
3
- smooth = 1e-15
4
-
5
-
6
- def iou(y_true, y_pred):
7
- def f(y_true, y_pred):
8
- intersection = (y_true * y_pred).sum()
9
- union = y_true.sum() + y_pred.sum() - intersection
10
- x = (intersection + 1e-15) / (union + 1e-15)
11
- x = x.astype(np.float32)
12
- return x
13
- return tf.numpy_function(f, [y_true, y_pred], tf.float32)
14
-
15
-
16
-
17
- def dice_coef(y_true, y_pred):
18
- y_true = tf.keras.layers.Flatten()(y_true)
19
- y_pred = tf.keras.layers.Flatten()(y_pred)
20
- intersection = tf.reduce_sum(y_true * y_pred)
21
- return (2. * intersection + smooth) / (tf.reduce_sum(y_true) + tf.reduce_sum(y_pred) + smooth)
22
-
23
-
24
- def dice_loss(y_true, y_pred):
25
- return 1.0 - dice_coef(y_true, y_pred)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Background_Removal_and_Change/remove_bg/R.jpg_1.png DELETED
Binary file (4.62 kB)
 
Background_Removal_and_Change/remove_bg/R.jpg_2.png DELETED
Binary file (4.84 kB)
 
Background_Removal_and_Change/remove_bg/R.jpg_3.png DELETED
Binary file (512 kB)
 
Background_Removal_and_Change/remove_bg/R.jpg_4.png DELETED
Binary file (131 kB)
 
Background_Removal_and_Change/remove_bg/R.jpg_5.png DELETED
Binary file (326 kB)
 
Background_Removal_and_Change/remove_bg/R.jpg_6.png DELETED
Binary file (839 kB)
 
Background_Removal_and_Change/remove_bg/beach.jpg_1.png DELETED
Binary file (1.52 kB)
 
Background_Removal_and_Change/remove_bg/beach.jpg_2.png DELETED
Binary file (1.74 kB)
 
Background_Removal_and_Change/remove_bg/beach.jpg_3.png DELETED
Binary file (7.93 kB)
 
Background_Removal_and_Change/remove_bg/beach.jpg_4.png DELETED
Binary file (659 kB)
 
Background_Removal_and_Change/remove_bg/beach.jpg_5.png DELETED
Binary file (394 kB)
 
Background_Removal_and_Change/remove_bg/beach.jpg_6.png DELETED
Binary file (398 kB)
 
Background_Removal_and_Change/remove_bg/messi.jpg_1.png DELETED
Binary file (8.19 kB)
 
Background_Removal_and_Change/remove_bg/messi.jpg_2.png DELETED
Binary file (8.58 kB)
 
Background_Removal_and_Change/remove_bg/messi.jpg_3.png DELETED
Binary file (453 kB)
 
Background_Removal_and_Change/remove_bg/messi.jpg_4.png DELETED

Git LFS Details

  • SHA256: 377ef7b1443a9573bfef12b9dddb90d7345eebb7fd58e440a4340ab6481df09e
  • Pointer size: 132 Bytes
  • Size of remote file: 2.06 MB
Background_Removal_and_Change/remove_bg/messi.jpg_5.png DELETED

Git LFS Details

  • SHA256: 652ab3fd4a66cc60a4d4fe234613a480939713e2487d6d3caac2497e9807de4c
  • Pointer size: 132 Bytes
  • Size of remote file: 1.1 MB
Background_Removal_and_Change/remove_bg/messi.jpg_6.png DELETED

Git LFS Details

  • SHA256: d954f831634ff0fe2f22b9ea01fe98dad8891858da42b3e285bd80f1a9b6dc93
  • Pointer size: 132 Bytes
  • Size of remote file: 1.59 MB
Background_Removal_and_Change/requirements.txt DELETED
Binary file (6.6 kB)
 
Background_Removal_and_Change/setup.sh DELETED
@@ -1,13 +0,0 @@
1
- mkdir -p ~/.streamlit/
2
-
3
- echo "\
4
- [general]\n\
5
- email = \"[email protected]\"\n\
6
- " > ~/.streamlit/credentials.toml
7
-
8
- echo "\
9
- [server]\n\
10
- headless = true\n\
11
- enableCORS=false\n\
12
- port = $PORT\n\
13
- " > ~/.streamlit/config.toml
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Background_Removal_and_Change/tempDir/R.jpg DELETED
Binary file (61.6 kB)