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 missing_values_table(df): | |
mis_val = df.isnull().sum() | |
mis_val_percent = 100 * df.isnull().sum() / len(df) | |
mis_val_table = pd.concat([mis_val, mis_val_percent], axis=1) | |
mis_val_table_ren_columns = mis_val_table.rename( | |
columns = {0 : 'Missing Values', 1 : '% of Total Values'}) | |
mis_val_table_ren_columns = mis_val_table_ren_columns[ | |
mis_val_table_ren_columns.iloc[:,1] != 0].sort_values( | |
'% of Total Values', ascending=False).round(1) | |
print ("Your selected dataframe has " + str(df.shape[1]) + " columns.\n" |
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
train = pd.read_csv("train.csv") | |
test = pd.read_csv("test.csv") |
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
#importing libraries | |
import numpy as np | |
import pandas as pd | |
from math import * | |
from sklearn.model_selection import train_test_split | |
from sklearn.preprocessing import MinMaxScaler, LabelEncoder | |
from sklearn.tree import DecisionTreeRegressor | |
import xgboost as xgb | |
import matplotlib as plt | |
from sklearn.metrics import mean_squared_error, r2_score |
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
# Visualize | |
fig, axes = plt.subplots(1, len(faces)) | |
for face, ax in zip(faces, axes): | |
ax.imshow(face.permute(1, 2, 0).int().numpy()) | |
ax.axis('off') | |
fig.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
face = mtcnn(frame) |
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
mtcnn = MTCNN(margin=40,select_largest=False,keep_all=true) |
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
# Load a single image and display | |
frame = cv2.imread("1.jpg") | |
# mtcnn process the image in RGB and opencv reads in BGR. So converting that. | |
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) | |
# generating image from array | |
frame = Image.fromarray(frame) | |
plt.figure(figsize=(12, 8)) | |
plt.imshow(frame) | |
plt.axis('off') |
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
from facenet_pytorch import MTCNN | |
import cv2 | |
from PIL import Image | |
import numpy as np | |
from matplotlib import pyplot as plt | |
from tqdm.notebook import tqdm |
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
pip install facenet-pytorch |
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
centroids.print("Centroids:"); |