Skip to content

Instantly share code, notes, and snippets.

View rbpatt2019's full-sized avatar
🤓
Always learning!

Ryan Patterson-Cross rbpatt2019

🤓
Always learning!
View GitHub Profile
@rbpatt2019
rbpatt2019 / plot_cm.py
Created March 30, 2020 15:36
A convenience function for plotting heatmaps with matplotlib and seaborn
import matplotlib.pyplot as plt
import seaborn as sns
def plot_cm(cm,
xlabs,
ylabs,
data_range=[0.0, 0.2, 0.4, 0.6, 0.8, 1.0],
title="Confusion Matrix",
xlabel="Predicted Labels",
ylabel="Actual Labels",
@rbpatt2019
rbpatt2019 / save_as_pdf.py
Created March 30, 2020 15:10
Save multiple images to one pdf using Pillow
from glob import glob
import os.path as path
from PIL import Image
def convert(img):
'''Convert an RGBA image to an RGB image
If the passed image has:
img.mode == 'RGBA'
then it will be converted to RGB.