Skip to content

Instantly share code, notes, and snippets.

View anuj2110's full-sized avatar
🎯
Focusing

ANUJ TREHAN anuj2110

🎯
Focusing
  • India
View GitHub Profile
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)))
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(" ")]
import 'dart:html';
void main(){
final ButtonElement button = querySelector('button');
button.onClick
.timeout(
new Duration(seconds:1),
import 'dart:async';
class Cake {}
class Order {
String type;
Order(this.type);
}
void main() {
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))