This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def convolutional_neural_network(x): | |
weights = {'W_conv1' : tf.Variable(tf.random_normal([3,3,3,64])), | |
'W_conv2' : tf.Variable(tf.random_normal([3,3,64,64])), | |
'W_conv3' : tf.Variable(tf.random_normal([3,3,64,128])), | |
'W_conv4' : tf.Variable(tf.random_normal([3,3,128,128])), | |
'W_conv5': tf.Variable(tf.random_normal([3,3,128,256])), | |
'W_conv6' : tf.Variable(tf.random_normal([3,3,256,256])), | |
'W_conv7' : tf.Variable(tf.random_normal([3,3,256,256])), | |
'W_conv8' : tf.Variable(tf.random_normal([3,3,256,512])), | |
'W_conv9' : tf.Variable(tf.random_normal([3,3,512,512])), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
activation_function = lambda x: 1.0/(1.0 + np.exp(-x)) | |
input = np.random.randn(3,1) | |
W1 = np.random.randn(None, 1) | |
W2 = np.random.randn(None,1) | |
W3 = np.random.randn(None,1) | |
b1 = np.zeros(1) | |
b2 = np.zeros(1) | |
b3 = np.zeros(1) | |
hidden_1 = activation(np.dot(W1, input) + b1) | |
hidden_2 = activation(np.dot(W2, W1) + b2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mean_filter = np.array([[1,1,1], [1,1,1], [1,1,1]])/float(9) | |
Gm = scipy.signal.convolve2d(gray,Mean_filter,mode='same') | |
plt.imshow(Gm,cmap='gray') | |
plt.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) | |
Gm = cv2.medianBlur(gray,3) | |
imgs = np.array([gray, Gm]) | |
labels = ['Original','Filtered'] | |
for i in range(1, column*row+1): | |
ax = fig.add_subplot(row,column,i) | |
ax.set_title(labels[i-1]) | |
plt.imshow(imgs[i-1], cmap='gray') | |
plt.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hg = np.zeros((20,20)) | |
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) | |
for i in range(20): | |
for j in range(20): | |
Hg[i,j] = np.exp(-((i-10) ** 2 + (j-10)**2)/10) | |
gaussian_blur = scipy.signal.convolve2d(gray, Hg, mode='same') | |
gray_high = gray - gaussian_blur | |
gray_enhanced = gray + 0.025 * gray_high |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) | |
Hx = np.array([[1,0,-1], [2,0,-2],[1,0,-1]], dtype=np.float32) | |
Hy = np.array([[-1,-2,-1],[0,0,0],[1,2,1]], dtype=np.float32) | |
Gx = scipy.signal.convolve2d(Gm, Hx, mode ='same') | |
Gy = scipy.signal.convolve2d(Gm,Hy,mode = 'same') | |
G = (Gx*Gx + Gy*Gy) ** 0.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Filter | Use | |
---|---|---|
Mean Filter | Reduce Gaussian Noise smooth the image after upsampling. | |
Median Filter | Reduce salt and pepper noise. | |
Sobel Filter | Detect edges in an image. | |
Gaussian Filter | Reduce noise in an image. | |
Canny Filter | Detect edges in an image. | |
Weiner Filter | Reduce additive noise and blurring. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from sklearn import preprocessing | |
features = np.array([[-500, 5], | |
[2, 10], | |
[4, 100], | |
[9, 10]]) | |
# Create the MinMax Scaler | |
minmax_scaler = preprocessing.MinMaxScaler(feature_range=(0,1)) | |
# Apply the MinMax Rescaling on our feature maps | |
scaled_feature = minmax_scaler.fit_transform(features) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from sklearn import preprocessing | |
features = np.array([[-500, 5], | |
[2, 10], | |
[4, 100], | |
[9, 10]]) | |
# Create the Standard Scaler | |
standard_scaler = preprocessing.StandardScaler() | |
# Apply the Standard Rescaling on our feature maps | |
scaled_feature = standard_scaler.fit_transform(features) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> ] | |
> activate . | |
> add IJulia BenchmarkTools Plots DataFrames CSV MLJ MLJModels TextAnalysis PyCall Chain Pipe Compose Gadfly Query Statistics StatsBase StableRNGs PrettyPrinting |
OlderNewer