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 cv2 | |
import numpy as np | |
def xyxy_to_xywh(xyxy): | |
""" | |
Convert XYXY format (x,y top left and x,y bottom right) to XYWH format (x,y center point and width, height). | |
:param xyxy: [X1, Y1, X2, Y2] | |
:return: [X, Y, W, H] | |
""" | |
if np.array(xyxy).ndim > 1 or len(xyxy) > 4: |
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 bb_intersection_over_union(boxA, boxB): | |
# determine the (x, y)-coordinates of the intersection rectangle | |
xA = max(boxA[0], boxB[0]) | |
yA = max(boxA[1], boxB[1]) | |
xB = min(boxA[2], boxB[2]) | |
yB = min(boxA[3], boxB[3]) | |
# compute the area of intersection rectangle | |
interArea = abs(max((xB - xA, 0)) * max((yB - yA), 0)) | |
if interArea == 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
def create_tf_example(example, path_root): | |
# import image | |
f_image = Image.open(path_root + example["image_name"]) | |
# get width and height of image | |
width, height = f_image.size | |
# crop image randomly around bouding box within a 0.15 * bbox extra range | |
if FLAGS.evaluation_status != "test": |
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 tensorflow.contrib.tensorboard.plugins import projector | |
import tensorflow as tf | |
import numpy as np | |
import os | |
meta_file = "g2x_metadata.tsv" | |
output_path = "./projections" | |
# read embedding file into list and get the size | |
with open('./ft_model.vec', 'r') as embedding_file: |
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
#deb cdrom:[Ubuntu 16.04.2 LTS _Xenial Xerus_ - Release amd64 (20170215.2)]/ xenial main restricted | |
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to | |
# newer versions of the distribution. | |
deb http://us.archive.ubuntu.com/ubuntu/ xenial main restricted | |
# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial main restricted | |
## Major bug fix updates produced after the final release of the | |
## distribution. | |
deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted |