Skip to content

Instantly share code, notes, and snippets.

View AruniRC's full-sized avatar

AruniRC AruniRC

View GitHub Profile
@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 / 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 / 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 / Make_caffe_centos.md
Last active July 13, 2018 15:09
Building caffe with multi-GPU support on CentOS
@AruniRC
AruniRC / Makefile.config
Created March 18, 2018 21:07
Faster RCNN Caffe makefile for Gypsum
## Refer to http://caffe.berkeleyvision.org/installation.html
# Contributions simplifying and improving our build system are welcome!
# cuDNN acceleration switch (uncomment to build with cuDNN).
USE_CUDNN := 1
# CPU-only switch (uncomment to build without GPU support).
# CPU_ONLY := 1
# uncomment to disable IO dependencies and corresponding data layers
@AruniRC
AruniRC / README_HARDNEG_MSCOCO.md
Last active March 10, 2018 19:56
Ms-coco hard negs on gypsum

Multi-Class Detection with RetinaNet

Location

On gypsum:

/mnt/nfs/scratch1/arunirc/data/MS-COCO_cls-1_hard-neg

@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 / gypsum_caffe2.md
Last active March 10, 2018 02:57
Setup Caffe2 and Detectron on cluster

Caffe2 setup

  • Copy the caffe2 folder from /mnt/nfs/work1/elm/hzjiang/Share/caffe2 to your own work/toolboxes folder. For me this was /home/arunirc/work1/Tools/caffe2/build.
  • Warning: make sure to remove Anaconda paths in your .bashrc, if any.
export PYTHONPATH=/mnt/nfs/work1/elm/arunirc/Tools/caffe2/build:$PYTHONPATH
export LD_LIBRARY_PATH=/mnt/nfs/work1/elm/arunirc/Tools/caffe2/build/lib:$LD_LIBRARY_PATH
@AruniRC
AruniRC / bash_oneliners.sh
Created March 1, 2018 15:30
One-liners in bash that come in handy
# A dataset like WIDER-face has folders like:
# 0--Parade 21--Festival 33--Running
# 45--Balloonist 57--Angler 10--People_Marching
# This one-liner splits on '--', takes the second sub-string and gets rid of the '_'
# NOTE: example usage of awk
ls | awk -F'--' '{printf "%s\n", $2}' | awk -F'_' '{printf "%s %s\n", $1, $2}'
@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])