Skip to content

Instantly share code, notes, and snippets.

View AruniRC's full-sized avatar

AruniRC AruniRC

View GitHub Profile
@AruniRC
AruniRC / ms_coco_classnames.txt
Created March 5, 2018 20:37
Class Names of MS-COCO classes in order of Detectron dict
{0: u'__background__',
1: u'person',
2: u'bicycle',
3: u'car',
4: u'motorcycle',
5: u'airplane',
6: u'bus',
7: u'train',
8: u'truck',
9: u'boat',
@AruniRC
AruniRC / bbox_iou_evaluation.py
Created February 22, 2018 16:10
Object detector util: match a set of detected bounding boxes and a set of ground-truth bounding boxes
from __future__ import division
import scipy.optimize
import numpy as np
def bbox_iou(boxA, boxB):
# https://www.pyimagesearch.com/2016/11/07/intersection-over-union-iou-for-object-detection/
# ^^ corrected.
# Determine the (x, y)-coordinates of the intersection rectangle
xA = max(boxA[0], boxB[0])
HANDY ONE-LINE SCRIPTS FOR AWK 30 April 2008
Compiled by Eric Pement - eric [at] pement.org version 0.27
Latest version of this file (in English) is usually at:
http://www.pement.org/awk/awk1line.txt
This file will also be available in other languages:
Chinese - http://ximix.org/translation/awk1line_zh-CN.txt
USAGE:
@AruniRC
AruniRC / check-files-exist-from-list.sh
Created August 9, 2018 19:48 — forked from HelenaEksler/check-files-exist-from-list.sh
Bash script to check files in list exist in directory
#!/usr/bin/env bash
#Check Files in list from file exist or doesn't exist in directory.
if [ $# -eq 0 ] || [ $# -eq 1 ]
then
echo "You must pass the path to file with the list and the path to directory to check files. \nsh check-file-exist-from-list.sh path/to/file path/to/directory"
exit 1
fi
while read -r file; do
@AruniRC
AruniRC / convert_face_to_coco.py
Created August 10, 2018 20:59
Get MS-COCO JSON from WIDER annotations
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import h5py
import json
import os
import scipy.misc
@AruniRC
AruniRC / draw_networkx_graph.py
Created July 30, 2019 23:16
Adding edge thickness and node colors in NetworkX graph plotting
# saliency
sal = cluster_saliency[cluster_label] # [ (grad-norm, grad-max)
grad_max = sal[1] / max(sal[1])
feat_vertices = features[cluster_ids, :]
adj_mat = get_adjmat(feat_vertices, is_norm_adj=False)
adj_mat_normed = get_adjmat(feat_vertices, is_norm_adj=True)
# create networkx graph from adjacency matrix
@AruniRC
AruniRC / video_frames.py
Created July 17, 2018 16:56
Get number of frames using Scikit-video and Python
'''
Sometimes it is useful to know the total number of video frames before starting to iterate.
This is not possible using the default video reader in Sk-video.
The snippet below shows how to do this using the FFMPEG reader instead.
'''
if osp.exists(video_path):
vid_reader = skvideo.io.FFmpegReader(video_path) # NOTE: not the standard skvideo.io.vreader
else:
raise IOError('Path to video not found: \n%s' % video_path)
@AruniRC
AruniRC / bash_profile
Last active August 14, 2020 22:46
Bashrc macbook home
export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\n\$ "
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
# User defined aliases
alias ls='ls -GFh'
# Mounting remote drives (create folder manually first under ~/Mount/remote-name)
alias mount-fisher='sshfs arunirc@fisher.cs.umass.edu:/ ~/Mount/fisher -o volname=fisher'
@AruniRC
AruniRC / histogram_spec_map.py
Created June 19, 2020 17:19
Histogram specification demo code
import os
import sys
import pickle
import json
import numpy as np
import sys
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
import os.path as osp
@AruniRC
AruniRC / bashrc_renyi
Last active April 19, 2020 16:52
Bashrc renyi server
force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=yes=no