Skip to content

Instantly share code, notes, and snippets.

View Mynuddin-dev's full-sized avatar
😁
Deep Learning

Md Mynuddin Mynuddin-dev

😁
Deep Learning
View GitHub Profile
@Mynuddin-dev
Mynuddin-dev / MM.py
Last active April 21, 2022 09:57
Matrix Multiplication
A = np.array([[1, 2],[3,4],[5,6]])
B = np.array([[1, 2, 3], [4, 5, 6]])
Result=[]
for i in range(0,len(A)):
temp=[]
for j in range(0,len(B[0])):
s = 0
for k in range(0,len(A[0])):
s += A[i][k]*B[k][j]
@Mynuddin-dev
Mynuddin-dev / CNNOM.py
Created April 21, 2022 09:59
Convolution output matrix for stride 1
import numpy as np
input_matrix=np.array([[3,0,1,2,7,4],
[1,5,8,9,3,1],
[2,7,2,5,1,3],
[0,1,3,1,7,8],
[4,2,1,6,2,8],
[2,4,5,2,3,9]
])
@Mynuddin-dev
Mynuddin-dev / Convert_sample_rate.sh
Last active August 24, 2022 04:32
sample rate convert to 48k
#!/usr/bin/bash
files=$(ls *.wav)
for file in $files;do
filename=$(echo $file | cut -d "." -f 1)
sox "$file" -r 48000 $filename{48000}.wav
done
```
@Mynuddin-dev
Mynuddin-dev / take_photo.py
Created May 30, 2022 09:26
Take photo by using webcam
import cv2
def take_photo():
cap = cv2.VideoCapture(0)
ret , frame = cap.read()
cv2.imwrite("SS.png",frame)
cap.release()
take_photo()
@Mynuddin-dev
Mynuddin-dev / CNN_X_Y.py
Last active November 4, 2022 07:13
train image data with cnn
import glob
from importlib.resources import path
from os import listdir
from os.path import isfile, join
import cv2
import os
import numpy as np
from random import shuffle
# from tqdm import tqdm
import pandas as pd
@Mynuddin-dev
Mynuddin-dev / LeNet5.py
Last active November 12, 2023 15:54
LeNet5 handwritten digit recognition
from keras.datasets import mnist
from keras.utils import to_categorical
from keras.layers import *
from keras.models import *
import numpy as np
## Load and preprocess the MNIST dataset
(train_images , train_labels) , (validation_images , validation_labels) = mnist.load_data()
## reshaping the images and normalizing the pixel values to be between 0 and 1.
train_images = train_images.reshape((60000, 28, 28, 1)).astype('float32') / 255
@Mynuddin-dev
Mynuddin-dev / traffic.py
Last active June 30, 2022 08:35
traffic ai50 assignment
import cv2
import glob
import numpy as np
import os
import sys
import tensorflow as tf
from sklearn.model_selection import train_test_split
EPOCHS = 10
@Mynuddin-dev
Mynuddin-dev / Image_resize.py
Created July 13, 2022 06:57
Multiple Image Resize
import cv2
import os
import numpy as np
path = "/home/myn/Downloads/all_images/"
destination = "/home/myn/Downloads/resized_all_images"
for img_name in os.listdir(path):
# print(img_path)
img = cv2.imread(str(path)+"/"+str(img_name))
# print(img.shape)
img = cv2.resize(img, (200,200), interpolation = cv2.INTER_AREA)
@Mynuddin-dev
Mynuddin-dev / vocab.py
Last active August 2, 2022 06:21
lexicon text to vocab text
with open("librispeech-lexicon.txt") as f:
liness = f.readlines()
vocabulary = open("vocab.txt" , 'w')
for line in liness:
vocabulary.write(line.split()[0] +"\n")
@Mynuddin-dev
Mynuddin-dev / utt2spk.py
Created August 4, 2022 08:06
For kaldi utt2spk file modified(sort)
with open("utt2spk") as f:
liness = f.readlines()
utt2spk_final = open("utt2spk_final.txt" , 'w')
for line in liness:
words = line.split()
utt = (words[1],words[0])
uttjoin = '-'.join(utt)
# print(uttjoin)