This file contains hidden or 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
####################### retinanet.py | |
def default_null_model( | |
pyramid_feature_size=256, | |
name='null_submodel' | |
): | |
options = { | |
'kernel_size' : 3, | |
'strides' : 1, | |
'padding' : 'same', | |
} |
This file contains hidden or 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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
% In this tutorial, we are going to implement knn algorithm. % | |
% Our aim is to see the most efficient implementation of knn. % | |
% You have to implement knn in two differnt ways: % | |
% 1) with two loops % | |
% 2) without any loop % | |
% % | |
% you have to report the computation times of both pathways. % | |
% Note: the distance metric is �Euclidean�. % | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
This file contains hidden or 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 numpy as np | |
from pycocotools.coco import COCO | |
import os | |
import math | |
import keras | |
from keras.models import Model | |
from keras.layers import Dense, Input, Flatten, Reshape | |
from keras.utils import plot_model | |
from random import shuffle |
This file contains hidden or 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
name: "1546" | |
layer { | |
name: "data" | |
type: "ImageSegData" | |
top: "data" | |
top: "label" | |
#top: "data_dim" | |
include { | |
phase: TRAIN |
This file contains hidden or 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 keras.optimizers import Optimizer | |
from keras import backend as K | |
from keras.legacy import interfaces | |
class MultiSGD(Optimizer): | |
""" | |
Modified SGD with added support for learning multiplier for kernels and biases | |
as suggested in: https://github.com/fchollet/keras/issues/5920 |
This file contains hidden or 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 focal_loss(gamma=2, alpha=0.75): | |
def focal_loss_fixed(y_true, y_pred): # compatible with tf backend | |
pt_1 = tf.where(tf.equal(y_true, 1), y_pred, tf.ones_like(y_pred)) | |
pt_0 = tf.where(tf.equal(y_true, 0), y_pred, tf.zeros_like(y_pred)) | |
return -K.sum(alpha * K.pow(1. - pt_1, gamma) * K.log(pt_1))-K.sum((1-alpha) * K.pow( pt_0, gamma) * K.log(1. - pt_0)) | |
return focal_loss_fixed |
This file contains hidden or 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
tb = TensorBoard( | |
log_dir='./logs/{}'.format(args.exp_dir), | |
histogram_freq=0, | |
batch_size=args.batch_size, | |
write_graph=True, | |
write_batch_performance=True, | |
write_grads=False, | |
write_images=False, | |
embeddings_freq=0, | |
embeddings_layer_names=None, |
This file contains hidden or 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
# coding: utf-8 | |
# In[ ]: | |
""" | |
Copyright (c) 2017, by the Authors: Amir H. Abdi | |
This software is freely available under the MIT Public License. | |
Please see the License file in the root for details. |
This file contains hidden or 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
mkdir coco | |
cd coco | |
mkdir images | |
cd images | |
wget http://images.cocodataset.org/zips/train2017.zip | |
wget http://images.cocodataset.org/zips/val2017.zip | |
wget http://images.cocodataset.org/zips/test2017.zip | |
wget http://images.cocodataset.org/zips/unlabeled2017.zip |
This file contains hidden or 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 keras | |
from keras.layers import Conv2D, UpSampling2D, BatchNormalization, Input, Add, MaxPool2D, Activation, Concatenate | |
from keras.models import Model | |
from utils.config import num_stages, num_joints | |
nFeatures = 256 | |
nStack = 8 | |
nModules = 1 | |
nOutChannels = num_joints |
OlderNewer