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
"""Script to illustrate usage of tf.estimator.Estimator in TF v1.5""" | |
import tensorflow as tf | |
from tensorflow.examples.tutorials.mnist import input_data as mnist_data | |
from tensorflow.contrib import slim | |
# Show debugging output | |
tf.logging.set_verbosity(tf.logging.DEBUG) | |
# Set default flags for the output directories |
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
#RT:RightTop | |
#LB:LeftBottom | |
def IOU(rectangle A, rectangleB): | |
xs = [A.RT.x, A.LB.x, B.RT.x, B.LB.x] | |
ys = [A.RT.y, A.LB.y, B.RT.y, B.LB.y] | |
s_x = sorted(xs) | |
s_y = sorted(ys) | |
if s_x[1] in [A.LB.x, B.LB.x] or s_y[1] in [A.LB.y, B.LB.y]: | |
return 0 |
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
function mpii_convert_json( ) | |
% convert mpii annotations .mat file to .json | |
%% load annotation file | |
fprintf('Load annotations... ') | |
data = load('/media/HDD2/Datasets/Human_Pose/mpii/mpii_human_pose_v1_u12_2/mpii_human_pose_v1_u12_1.mat'); | |
fprintf('Done.\n') | |
%% open file | |
fprintf('Open file mpii_human_pose_annotations.json\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
def label2xml(list_path, category_id, ANN_DIR='data/Annotations/', IMG_DIR='data/images/', SET_DIR='data/ImageSets/', | |
train=True): | |
set_file_list = [SET_DIR + 'train.txt', SET_DIR + 'minival.txt', SET_DIR + 'testdev.txt', SET_DIR + 'test.txt'] | |
TYPEPREFIX = 'train' if train else 'val' | |
lines = read_lines(list_path) | |
line_i = 0 | |
last_name = '' | |
E = None | |
img_annotation = None |
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 map_rank_faster_eval(query_info, test_info, result_argsort): | |
# about 10% lower than matlab result | |
# for evaluate rank1 and map | |
match = [] | |
junk = [] | |
for q_index, (qp, qc) in enumerate(query_info): | |
tmp_match = [] | |
tmp_junk = [] | |
for t_index in range(len(test_info)): |
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 keras.layers.merge import Concatenate | |
from keras.layers.core import Lambda | |
from keras.models import Model | |
import tensorflow as tf | |
def make_parallel(model, gpu_count): | |
def get_slice(data, idx, parts): | |
shape = tf.shape(data) | |
size = tf.concat([ shape[:1] // parts, shape[1:] ],axis=0) |