Skip to content

Instantly share code, notes, and snippets.

WittmannF

Block or report user

Report or block WittmannF

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View face_recognition.md

Face Recognition in Python with the OpenCV Library

In this post we will use the OpenCV library for facial recognition. Here is an example using my webcam as an input:

The best part is that it can be done using less than 20 lines of code:

View solucao-ashrae-kaggle.py
## Imports
from ashrae_utils import reduce_mem_usage, CyclicLR, LRFinder
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
import math
import tqdm
import gc
from sklearn.linear_model import RidgeCV
import seaborn as sns
View bi-wp-familia.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@WittmannF
WittmannF / take-element-screenshot-selenium.py
Last active Jan 10, 2020
Function for taking a screenshot of an element using selenium
View take-element-screenshot-selenium.py
from selenium import webdriver
from PIL import Image
from io import BytesIO
def take_screenshot(element, driver, filename='screenshot.png'):
"""
Source: https://stackoverflow.com/questions/15018372/how-to-take-partial-screenshot-with-selenium-webdriver-in-python
"""
location = element.location_once_scrolled_into_view
size = element.size
View bi-wp-familia.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@WittmannF
WittmannF / lr_finder_keras.py
Last active Mar 28, 2020
Learning Rate Finder as a Keras Callback
View lr_finder_keras.py
from keras.callbacks import Callback
import keras.backend as K
import numpy as np
import matplotlib.pyplot as plt
class LRFinder(Callback):
"""
Up-to date version: https://github.com/WittmannF/LRFinder
Example of usage:
from keras.models import Sequential
@WittmannF
WittmannF / lr_finder.py
Last active May 30, 2019 — forked from jeremyjordan/lr_finder.py
Keras Callback for finding the optimal range of learning rates
View lr_finder.py
import matplotlib.pyplot as plt
import keras.backend as K
from keras.callbacks import Callback
class LRFinder(Callback):
'''
A simple callback for finding the optimal learning rate range for your model + dataset.
@WittmannF
WittmannF / compare_r2.py
Created Jan 23, 2019
Very simple code for comparing different R2 scores
View compare_r2.py
from sklearn.datasets import make_regression
from sklearn.metrics import r2_score
import matplotlib.pyplot as plt
#%matplotlib inline
# Generate toy data
X, y, w_true = make_regression(n_samples=20, n_features=1, random_state=0, noise=1.0, coef=True)
w_bad = 0.5*w_true
w_verybad = -0.3*w_true
@WittmannF
WittmannF / exemplo_bizelli.py
Last active Nov 21, 2018
Rename subtitles from Udacity class. Code by Bizelli.
View exemplo_bizelli.py
import os
def rename_dir(path,sufix,extension_searched):
for file_name in os.listdir(path):
file_name_without_ext = os.path.splitext(file_name)[0]
extension = os.path.splitext(file_name)[1]
if extension == extension_searched:
if file_name_without_ext.rfind(sufix) > 0:
new_file_name = file_name[:file_name_without_ext.rfind(sufix)] + extension_searched
os.rename(os.path.join(path,file_name),os.path.join(path,new_file_name))
@WittmannF
WittmannF / whatsapp_api.py
Created Nov 14, 2018
WhatsApp API Selenium
View whatsapp_api.py
"""
### Implemented Methods
- Get contacts from a selected group
### Requires
- Selenium: `pip install selenium`
- ChromeDriver: http://chromedriver.chromium.org/
- After downloading chromedriver, make sure to add in a folder accessible from the PATH
### Example of Usage:
You can’t perform that action at this time.