This file contains hidden or 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
from tensorflow.keras.models import Sequential | |
from tensorflow.keras.layers import Conv2D,MaxPooling2D,BatchNormalization,Dropout,Flatten,Dense | |
num_features = 64 | |
num_labels=7 | |
model = Sequential() | |
model.add(Conv2D(num_features, kernel_size=(3, 3), activation='relu', input_shape=(48, 48, 1), kernel_regularizer=l2(0.01))) | |
model.add(Conv2D(num_features, kernel_size=(3, 3), activation='relu', padding='same')) | |
model.add(BatchNormalization()) | |
model.add(MaxPooling2D(pool_size=(2, 2), strides=(2, 2))) |
This file contains hidden or 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 pandas as pd | |
import numpy as np | |
def loadDataFromCSV(path="fer2013/fer2013.csv"): | |
df = pd.read_csv(path) #readeing the csv | |
pixels = df["pixels"].tolist() #extracting the pixels column | |
emotions = pd.get_dummies(df["emotion"]).as_matrix() #extracting emotions and turning them into one-hot labels | |
faces = [] #list for storing faces | |
for pixel_sequence in tqdm(pixels): #main loop for turning the pixel value to images and storing them as numpy arrays | |
face = [int(pixel) for pixel in pixel_sequence.split(" ")] |
This file contains hidden or 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 'dart:html'; | |
void main(){ | |
final ButtonElement button = querySelector('button'); | |
button.onClick | |
.timeout( | |
new Duration(seconds:1), |
This file contains hidden or 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 'dart:async'; | |
class Cake {} | |
class Order { | |
String type; | |
Order(this.type); | |
} | |
void main() { |
This file contains hidden or 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 | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
def get_weights(total_data): | |
''' | |
function for initialize random values in the weight vectors for the neural network to be used. | |
uses the no of features to initialize a vector. | |
''' | |
y = np.random.random()*(2.0/np.sqrt(total_data)) |
NewerOlder