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
# NOTE : run within DATASET folder | |
# project 2D mask, 3D bounding box, and vertices from the mesh into the dataset | |
import glob | |
import json | |
import os | |
import cv2 | |
import matplotlib.pyplot as plt | |
import numpy as np |
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
# NOTE : run within DATASET folder | |
# project 2D mask, 3D bounding box, and vertices from the mesh into the dataset | |
import glob | |
import json | |
import os | |
import cv2 | |
import matplotlib.pyplot as plt | |
import numpy as np |
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
import glob | |
import skimage | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from PIL import Image | |
import glob | |
import matplotlib.pyplot as plt | |
import numpy as np |
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 generate_interactive_plot(y_pred, y_true, gids, img_pattern): | |
colors=["red", "gold", "limegreen"] | |
projected_points = projectSimplex(y_pred) | |
labels = ['0', '1', '2+'] | |
from bokeh.plotting import figure, output_file, show, ColumnDataSource | |
from bokeh.models import HoverTool | |
URLs = [] | |
web_colors = [] |
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
import glob | |
images = glob.glob("*.jpg") | |
import re | |
import os | |
import matplotlib.pyplot as plt | |
import numpy as np | |
import cv2 | |
from PIL import Image |
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
import glob | |
import skimage | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from PIL import Image | |
import glob | |
import matplotlib.pyplot as plt | |
import numpy as np |
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
import glob | |
images = glob.glob("*.jpg") | |
import re | |
import os | |
import matplotlib.pyplot as plt | |
def natural_sort(l): | |
convert = lambda text: int(text) if text.isdigit() else text.lower() | |
alphanum_key = lambda key: [ convert(c) for c in re.split('([0-9]+)', key) ] | |
return sorted(l, key = alphanum_key) |
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
import scipy.stats | |
import numpy as np | |
import scipy.optimize | |
obs_data = [ | |
0.08982035928143713 | |
,0.06818181818181818 | |
,0.012987012987012988 | |
,0.05357142857142857 | |
,0.045454545454545456 |
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 custom_cat_crossentropy(y_true, y_pred): | |
# negate 3x3 sub matrix of income matrix to get cost matrix | |
# check https://github.com/tensorflow/tensorflow/blob/r1.10/tensorflow/python/keras/backend.py#L3461 | |
cost_m = tf.constant([[ 0.00222222, 0.01111111, 0.00222222], | |
[ 0.00222222, -0.05888889, 0.00222222], | |
[ 0.00222222, 1.51111111, 0.00222222]]) | |
y_true = tf.matmul(y_true, cost_m) | |
return tf.keras.losses.categorical_crossentropy(y_true, y_pred) |
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 keras model from disk | |
model_name = "GVC_IncepvtionV3_epoch_6_vanilla_vgg_chute_date_2018_07_27" | |
json_file = open(model_name+'.json', 'r') | |
model_json = json_file.read() | |
json_file.close() | |
model = tensorflow.keras.models.model_from_json(model_json) | |
# load weights into new model | |
model.load_weights(model_name+".h5") | |
print("Loaded model from disk") |
NewerOlder