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
""" only part codes """ | |
# read groundtruth and predictions | |
dataDir= Path('datasets/coco') | |
valImageRoot = dataDir / 'val2017' | |
groudtruth_path = dataDir / 'annotations/instances_val2017.json' | |
prediction_path = 'output/inference/coco_instances_results.json' | |
cocoGt=COCO(groudtruth_path) | |
cocoDt = cocoGt.loadRes(prediction_path) |
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 json | |
from pathlib import Path | |
import glob | |
import os | |
import shutil | |
from tqdm import tqdm | |
import numpy as np |
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 os | |
import mxnet as mx | |
from mxnet import ndarray as nd | |
from easydict import EasyDict as edict | |
import json | |
import copy | |
SRC_SYM = './models/vgg-softmax-emore/model' | |
TGT_SYM = './models/vgg-softmax-emore-bnMerged/model' |
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
# drawMatches numpy version | |
def draw_matches(img1, kp1, img2, kp2, matches, color=None): | |
"""Draws lines between matching keypoints of two images. | |
Keypoints not in a matching pair are not drawn. | |
Places the images side by side in a new image and draws circles | |
around each keypoint, with line segments connecting matching pairs. | |
You can tweak the r, thickness, and figsize values as needed. | |
Args: | |
img1: An openCV image ndarray in a grayscale or color format. | |
kp1: ndarray [n1, 2] |
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
""" | |
Usage: | |
python gpu_analysis.py <gpu_load.txt> <gpu_num> | |
""" | |
import sys | |
gpu_num = int(sys.argv[2]) | |
total = 0 | |
utilized = 0 | |
for line in open(sys.argv[1]).readlines(): |
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
""" | |
This file read a .abf file, find the peaks and troughs, and calculate delta values | |
Requirements: | |
pyabf | |
numpy | |
matplotlib | |
""" | |
import numpy as np | |
import sys |
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
""" | |
Show three windows to visualize predictions, ground truth labels and real colors | |
press key t to synchronize the camera setting in win_follow | |
""" | |
import open3d as o3d | |
import numpy as np | |
import copy | |
import threading | |
import time | |
from easydict import EasyDict as edict |
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
# Non_maximum_suppression | |
import numpy as np | |
def nms(dets, scores, thresh): | |
''' | |
dets is a numpy array : num_dets, 4 | |
scores ia nump array : num_dets, | |
''' | |
x1 = dets[:, 0] |
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
#include <iostream> | |
#include <chrono> | |
#include <ctime> | |
#include <cmath> | |
class Timer | |
{ | |
public: | |
void start() | |
{ |
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
while true | |
do | |
m=`nvidia-smi --format=csv --query-gpu=memory.used 2>&1 | awk '{if(NR>1 && NR<=2)print $1}'` | |
if [ $m -lt 2000 ] | |
then | |
echo executing | |
exec python tools/train.py --gpus 0,1 configs/res18.yaml --name res18_base | |
else | |
echo memory $m | |
sleep 1 |
OlderNewer