File size: 12,230 Bytes
1ee22b2
7d484d7
1ee22b2
3a2b23c
360bc2e
 
7d484d7
f99fef7
 
e6c4efc
857b16b
125c51b
 
9d4f20e
857b16b
 
 
f99fef7
 
 
 
 
551e06e
f99fef7
79db350
f99fef7
7d484d7
 
 
 
 
 
 
 
 
f99fef7
caae733
f99fef7
857b16b
 
5e3cd6a
f99fef7
7d484d7
31702fc
7d484d7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2fe87f0
d35f7a5
2fe87f0
360bc2e
7c60ce9
 
eb1380e
7c60ce9
1ee22b2
f99fef7
1ee22b2
 
dfa96da
b26d8d1
1ee22b2
 
 
 
 
056b95b
 
cc6c03c
056b95b
dfa96da
57a475b
71bca5c
da06e0d
6b5af0c
 
 
 
eb1380e
a62cf0b
9d4f20e
894b9dd
 
9028254
894b9dd
9028254
6979e4c
1035252
d44ce8b
1035252
 
 
 
 
6979e4c
6b45b7c
6979e4c
 
 
 
 
 
 
6b45b7c
 
 
 
6979e4c
 
22e0349
2fe87f0
6979e4c
2fe87f0
6979e4c
22e0349
 
7c60ce9
6979e4c
167962a
6979e4c
 
97af1c7
6979e4c
167962a
6979e4c
167962a
6979e4c
97af1c7
fd713b8
3d9dd3f
6979e4c
e33f773
 
894b9dd
e33f773
894b9dd
e33f773
894b9dd
e33f773
894b9dd
eb1380e
 
 
832ce69
eb1380e
894b9dd
eb1380e
894b9dd
eb1380e
894b9dd
eb1380e
9d4f20e
 
 
 
 
 
f3578e0
9d4f20e
 
 
6b45b7c
 
 
 
 
 
 
 
 
6979e4c
eb1380e
 
6979e4c
eb1380e
6979e4c
eb1380e
6979e4c
eb1380e
6979e4c
 
 
 
 
 
 
 
0e9a5b1
9d4f20e
 
1ee22b2
9d4f20e
db038b3
9d4f20e
040609d
4237b19
040609d
f99fef7
 
db038b3
 
 
 
 
9ba2fd6
f99fef7
 
 
 
 
 
 
591c9bd
f99fef7
eb317ef
f99fef7
eb317ef
7d484d7
 
 
 
 
 
 
9a9b757
7d484d7
 
 
 
 
 
 
 
 
25135e5
7d484d7
25135e5
125c51b
325b0d3
125c51b
 
 
 
 
 
 
 
 
 
 
 
 
 
e1af19f
125c51b
db038b3
 
 
 
 
 
9ba2fd6
897463f
 
 
 
 
 
 
 
 
e556d0c
897463f
e556d0c
43c4ef5
125c51b
82852c8
 
 
 
db038b3
 
3b2c87d
a50f68d
 
 
 
 
 
 
 
 
 
 
3bfcb5d
db038b3
 
 
a62cf0b
db038b3
5c06543
 
 
 
 
 
581b0f7
5c06543
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
import streamlit as st
from ultralytics import YOLO
from streamlit_option_menu import option_menu
import tensorflow as tf
import json
from streamlit_lottie import st_lottie
from PIL import Image,ImageFont,ImageDraw
from tensorflow.keras.models import load_model
import numpy as np
from tensorflow.keras.utils import custom_object_scope
import tensorflow_addons as tfa
from joblib import load
from sklearn.feature_extraction.text import TfidfVectorizer

def create_in():
    return tfa.layers.InstanceNormalization()
    
def img_prep(paths):
    out = []
    for i in paths:
        img = Image.open(i)
        img = img.resize((256,256))
        img = img.convert('RGB')
        out.append(img)
    return out

def img_prep_YOLO(paths,size):
    out = []
    for i in paths:
        img = Image.open(i)
        img = img.resize((size,size))
        img = img.convert('RGB')
        out.append(img)
    return out

def model_out(img,model_path):
    img = ((np.asarray(img))/127.5)-1
    img = np.expand_dims(img,0)
    with custom_object_scope({'InstanceNormalization': create_in}):
        model = load_model(model_path)
    pred = ((model.predict(img)+1)*127.5)/255
    return pred[0]

def yolo_out(model,img):
    model = YOLO(model)
    results = model(img)
    for result in results:
        cls = result.boxes.cls[0]
        cls = arr[int(cls)]
        lbl = result.boxes.conf[0]
        boxes = result.boxes.xyxy[0]
        draw = ImageDraw.Draw(img)
        draw.rectangle([boxes[0], boxes[1], boxes[2], boxes[3]], outline="black", width=5)
        text_position = (boxes[0]+boxes[2])/2, boxes[1]-10
        draw.text(text_position, f'{cls} {lbl}', fill="red", font=font)

    return img
        
font_size = 40
font = ImageFont.truetype("arial.ttf", size=font_size)
arr = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']

def lottiemaker(path):
    with open(path) as f:
        return json.load(f)

def loadimg(path):
    img = Image.open(path)
    img = img.resize((150,150))
    return img


selected = option_menu(
    menu_title=None,
    options = ['About me','Tools and Experience','Projects','Contacts'],
    icons=['house','gear','book','phone'],
    default_index=0,
    orientation="horizontal"
)

if selected == 'About me':
    col1,col2 = st.columns(2)# Display the Lottie animation in the first column
    with col1:
        st_lottie(lottiemaker('Animation - 1704777936737.json'), speed=1, width=400, height=370)
    with col2:
        st.write('# Hi, I am Pallab Ghosh')
    st.header('Let me introduce myself')
    
    st.write('I am Pallab Ghosh from West Bengal, India')
    st.write('I am a Self Taught Machine Learning Engineer and Programmer')
    st.write("My passion include Machine Learning, Programming, Gaming, Football, Badminton, Maths, etc")
    st.write('I am currently in High school')
    st.write('I have been learning Machine learning since 2021 and have Made more than 50 projects in the field of Machine Learning')
    st.write('---')
elif selected == 'Tools and Experience':
    st.header('Tools and Expertise')
    col1,col2 = st.columns(2)
    with col1:
        st.write('Below are the tools I use to train AI and the Machine Learning and Deep Learning models I have expertise in')
    with col2:
        st_lottie(lottiemaker('Tools.json'),speed=1,width=300,height=200)

    st.write('# Programming Languages')
    _,col1,col2,_ = st.columns(4)
    with col1:
        st.button('\n \t Python \t \n')
    with col2:
        st.button('\n \t MySQL \t \n')

    st.write('# Machine Learning Frameworks')
    col1,col2,col3,col4,col5 = st.columns(5)

    with col1:
        st.button('\n \t Tensorflow \t \n')
    with col2:
        st.button('\n \t Keras \t \n')
    with col3:
        st.button('\n \t Scikit-Learn \t \n')
    with col3:
        st.button('\n \t Mediapipe \t \n')
    with col3:
        st.button('\n \t CVzone \t \n')

    st.write('# Machine Learning Algorithim')
    col1,col2 = st.columns(2)
    with col1:
        st.button("\n \t Linear Regression \t \n")
    with col2:
        st.button('\n \t Logistic Regression \t \n')

    col3,col4 = st.columns(2)
    with col3:
        st.button('\n \t Naive Bayes \t \n')
    with col4:
        st.button('\n \t Decision Tree \t \n')

    col1,col2 = st.columns(2)

    with col1:
        st.button('\n \t Random Forest \t \n')
    with col2:
        st.button('\n \t K Nearest Neighbour \t \n')

    st.button('\n \t Support Vector Machine \t \n')

    st.write('# Deep Learning Architectures')
    col1,col2,col3,col4 = st.columns(4)
    with col1:
        st.button('Artificial Neural Network')
    with col2:
        st.button("Convolutional Neural Network")
    with col3:
        st.button("Deep Convolutional Genertive Adversarial Network")
    with col4:
        st.button("Cycle Consistent Generative Adversarial Network") 

    col1,col2,col3,col4 = st.columns(4)
    with col1:
        st.button("Paired Image Translation using Pix2Pix")
    with col2:
        st.button("Object Detection using YOLO")
    with col3:
        st.button("Unet model for semantic segmentation")
    with col4:
        st.button("Segmentation using YOLO")  

    col1,col2,col3,col4 = st.columns(4)
    with col1:
        st.button("\n \t StyleGan \t \n")
    with col2:
        st.button("Facebook Prophet model for timeceries prediction")
    with col3:
        st.button("Bidirectional Encoder Representations from Transformers /n (BERT)")
    with col4:
        st.button("Recurrent Neural Network(RNN) and Long Stort Term Memory(LSTM)")

    col2,col3,col4 = st.columns(3)

    with col2:
        st.button("Hand Landmarks detection")
    with col3:
        st.button("Body Landmarks detection")
    with col4:
        st.button("Face Landmarks detction")

    st.write('# Data Preprocessing and Visualisation')
    col1,col2,col3,col4 = st.columns(4)
    with col1:
        st.button('\n \t Numpy \t \n')
    with col2:
        st.button('\n \t Pandas \t \n')
    with col3:
        st.button('\n \t Pillow \t \n')
    with col4:
        st.button('\n \t Matplotlib \t \n')

    st.write('# Model Deployment')

    _,col1,_ = st.columns(3)

    with col1:
        st.button('\n \t Streamlit \t \n')

    st.write("---")

elif selected == 'Projects':
    st.header('Projects')
    st.write('I have made more than 50 projects in fields including CNN, GAN, Machine Learning, Yolo object detection and segmentation, Pix2pix, Cyclegan and more')
    st.write('Below are some models(one from each category)')
    
    options = {'Cyclegan':1, 'DCGAN':2,'Unet':3,'Machine Learning Text classifier':4,'YOLO object detection':5}
    selected_option = st.selectbox('Select an option', options)

    if selected_option == 'Unet':
        st.header('Description')
        st.write('This is a UNET model that segments the waterbodies in the image')
        st.header('Architecture')
        st.write('The model is of unet architecture to preserve the spatial informations in the images after applying Conv2D')
        
        imgs = img_prep(['unet1.jpg','unet2.jpg'])
        col1,col2 = st.columns(2)
        with col1:
            st.image(imgs[0],use_column_width=False)
        with col2:
            st.image(imgs[1],use_column_width=False)

        img_options = {'img1':1, 'img2':2}
        img_selected_option = st.selectbox('Select an Image', img_options)
        if img_selected_option == 'img1':
            st.image(model_out(imgs[0],'Portfolio Projects/FloodAreaSegmentationUnetPix2Pix.h5'),use_column_width=False)
        if img_selected_option == 'img2':
            st.image(model_out(imgs[1],'Portfolio Projects/FloodAreaSegmentationUnetPix2Pix.h5'),use_column_width=False)

    if selected_option == 'YOLO object detection':
        st.header('Description')
        st.write('This is an YOLO mdoel which can detect different hand sign in an image')
        st.header('Architecture')
        st.write('The model uses YOLOv8 to do the detection')
        
        imgs = img_prep_YOLO(['YOLOB.jpg','YOLOC.jpg'],416)
        col1,col2 = st.columns(2)
        with col1:
            st.image(imgs[0],use_column_width=False)
        with col2:
            st.image(imgs[1],use_column_width=False)

        img_options = {'img1':1, 'img2':2}
        img_selected_option = st.selectbox('Select an Image', img_options)
        if img_selected_option == 'img1':
            st.image(yolo_out('Portfolio Projects/HandSignDetector.pt',imgs[0]),use_column_width=False)
        if img_selected_option == 'img2':
            st.image(yolo_out('Portfolio Projects/HandSignDetector.pt',imgs[1]),use_column_width=False)
            
    elif selected_option == 'Machine Learning Text classifier':
        
        st.header('Spam Detection using Naive Bayes Classifier')
        vectorizer = load('Portfolio Projects/tfidf_vectorizer.joblib')
        user_input = st.text_input("Enter some text:", "")
        if user_input is not None:
            x = vectorizer.transform([user_input])
            model = load('Portfolio Projects/Naive_Bayes_Spam_Detection.joblib')
            pred = model.predict(x)
            if pred[0] == 1:
                st.write('The entered text is a Spam')
            elif pred[0] == 0:
                st.write('The entered text is not a Spam')
            else:
                st.write('Error, Try again')
                
    elif selected_option == 'Cyclegan':
        st.header('Description')
        st.write('This is a CycleGAN model that turns an input image into an Image of a Monet Painting')
        st.header('Architecture')
        st.write('The Generator model is the prebuild tensorflow pix2pix generator model')
        st.write('The Discriminator model is the discriminator model from the same module')
        
        imgs = img_prep(['cyclegan1.jpg','cyclegan2.jpg'])
        col1,col2 = st.columns(2)
        with col1:
            st.image(imgs[0],use_column_width=False)
        with col2:
            st.image(imgs[1],use_column_width=False)

        img_options = {'img1':1, 'img2':2}
        img_selected_option = st.selectbox('Select an Image', img_options)
        if img_selected_option == 'img1':
            st.image(model_out(imgs[0],'Portfolio Projects/photo2monet2.h5'),use_column_width=False)
        if img_selected_option == 'img2':
            st.image(model_out(imgs[1],'Portfolio Projects/photo2monet2.h5'),use_column_width=False)

    elif selected_option == 'DCGAN':

        st.header('Description')
        st.write('This is a DCGAN model that turns a random noise vector into an Image of a dog(that sometimes turns out disformed) using Convolutional2D Transpose layers')
        st.header('Architecture')
        st.write('The Generator model is just a set of Convolutional2D Transpose, BatchNormalization and Leaky relu')
        st.write('The Discriminator model is a very simple model with Convolutional2D, Dropout and Leaky Relu')
        model = tf.keras.models.load_model('Portfolio Projects/doggen3.h5')

# Create a button
        button_clicked = st.button("Generate")

# Check if the button is clicked
        if button_clicked:
    # Generate an image
            seed = tf.random.normal((1, 100))
            pred = model.predict(seed)
            pred = pred * 0.5 + 0.5  # Normalize the pixel values
            pred = np.squeeze(pred)  # Remove singleton dimensions if any
            st.image(pred,use_column_width=True)

    st.write('To see other projects, You can Visit my profile on HuggingFace')
    st.link_button('\n \t \t \t HuggingFace Account \t \t \r \n','https://huggingface.co/Beasto')
elif selected == 'Contacts':
    st.header('Contact me')
    col1,col2,col3,col4 = st.columns(4)
    with col1:
        st.link_button('\n \t \t \t  Instagram \t \t \r \n','https://www.instagram.com/i_suck_at_coding.256/')
    with col2:
        st.link_button('\n \t \t \t Github \t \t \r \n','https://github.com/Beastojenisto')
    with col3:
        st.link_button('\n \t \t \t Twitter/X \t \t \r \n','https://twitter.com/Isuckatcodinboi') 
    with col4:
        st.link_button('\n \t \t \t HuggingFace \t \t \r \n','https://huggingface.co/Beasto')