Skip to content

Instantly share code, notes, and snippets.

View pppoe's full-sized avatar
🎮
:)

Haoxiang Li pppoe

🎮
:)
View GitHub Profile
@pppoe
pppoe / 2d-points-sampler.py
Created January 2, 2024 05:49
Sample 2D points from a 2D binary 0-1 mask
import numpy as np
import cv2
import random
I = cv2.imread('image.png')
mask = np.load('mask.npy')
mask = (mask[:,:,0] > 0) # True / False binary matrix
visI = np.zeros_like(I)
def sample_prompt_pts(mask, h_resol=128, w_resol=128, max_pts=128, K = 20):
#! /bin/bash
docker build --build-arg UID=$(id -u) --build-arg GID=$(id -g) --build-arg UNAME=$USER\
-t hxli .
#! /bin/bash
docker ps -aq -f status=exited | xargs docker rm
#! /bin/bash
@pppoe
pppoe / setup.sh
Created February 6, 2018 06:12
A script to quickly install Tensorflow and setup a separated environment for dev
## put this into ~/Tensorflow/setup.sh settings are for Mac/CPU python3.5 by default, after installation, use $tf to load the env vars
#! /bin/bash
RootDir=$PWD/Tensorflow/
## Modify this line to install a different version of anaconda
AnacondaURL="https://repo.continuum.io/archive/Anaconda3-4.2.0-MacOSX-x86_64.sh"
## Modify this line to install a specific version of tensorflow
@pppoe
pppoe / UbuntuROS14.04.sh
Created April 14, 2017 21:37
Setup Ubuntu 14.04 and ROS
#! /bin/bash
sudo apt-get update
sudo apt-get install openbox tmux cmake vim git suckless-tools
git clone --recursive https://github.com/pppoe/Vim-Bash-Configuration
~/Vim-Bash-Configuration/make_symbolic_links.sh ~/Vim-Bash-Configuration/
sudo apt-get remove resolvconf update-manager network-manager
sudo apt-get install openssh-server
sudo apt-get install libudev-dev libusb-1.0-0-dev
# ROS
@pppoe
pppoe / export_3DDFA.m
Created February 13, 2017 01:00
export out data from 3DDFA
output_root = 'extracted';
mkdir(output_root);
num_lms = 68;
lines = textread('flist', '%s');
num_lines = length(lines);
for ff = 1:num_lines
fpath = lines{ff};
@pppoe
pppoe / Convert COFW dataset
Created September 23, 2016 05:06
Quick Script to dump out images and annotations from the COFW dataset
## http://www.vision.caltech.edu/xpburgos/ICCV13/
output_dets_f = './dets-COFW-train.txt'
image_root = './COFW-train-';
load('COFW_train.mat');
imgs = IsTr;
bboxes = bboxesTr;
lms = phisTr;
% output_dets_f = './dets-COFW-test.txt'
@pppoe
pppoe / ImageNet_mean_224
Created March 24, 2016 17:42
ImageNet Mean Values 3x224x224
This file has been truncated, but you can view the full file.
113.265
113.308
113.436
113.515
113.68
113.75
113.871
113.894
114.026
@pppoe
pppoe / cmake-check-system-os
Created April 29, 2014 19:52
CMake check system OS
IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# Mac OS X specific code
SET(OperatingSystem "Mac OS X")
ELSEIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
SET(OperatingSystem "Linux")
ELSE()
SET(OperatingSystem "Others")
ENDIF()
@pppoe
pppoe / discriminativecov.m
Created December 8, 2013 05:09
[CV] within-class and between-class covariance matrix
function [withincovar, betweencovar] = discriminativecov(X, ids)
arr_ids = int16(ids);
dim = size(X, 2);
num_pts = size(X, 1);
num_class = size(unique(arr_ids), 1);
arr_ids_sets = cell(num_class,1);
arr_ids_count = zeros(num_class,1);
for i = 1:num_class
@pppoe
pppoe / binary.cc
Created April 26, 2013 17:22
fread fwrite fprintf fscanf, C-style strtok and C++ getline for tokenize
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
/* Binary IO*/
/*