Skip to content

Instantly share code, notes, and snippets.

View StevenPuttemans's full-sized avatar

Steven Puttemans StevenPuttemans

View GitHub Profile
# Rule based filtering of skin pixels
# (RED>95) && (GREEN>40) && (BLUE>20) && ((max(RED,max(GREEN,BLUE)) - min(RED,min(GREEN,BLUE)))>15) && (abs(RED-GREEN)>15) && (RED>GREEN) && (RED>BLUE);
result = np.zeros(img_color.shape)
# Method 1 - naive with loops
# Remember BGR color space in OpenCV
for row in range(img_color.shape[0]):
for col in range(img_color.shape[1]):
if (img_color[row, col, 2] > 95): # Condition on RED channel
@StevenPuttemans
StevenPuttemans / gist:21e7afa840b8640e5b6579be2e8ad2d7
Created November 20, 2018 13:01
Inside Docker, pull a repository again, using argument
docker build . --build-arg PULLAGAIN=$(date +%s) -t rsnet:devel
+++
# Travel locations
widget = "custom"
active = true
date = "2018-03-23T00:00:00"
+++
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
@StevenPuttemans
StevenPuttemans / docker-commands.md
Last active May 31, 2018 13:07
docker-commands

Overview of frequently used docker command

Running dockers

Run your docker with a specific executable and then shut down: sudo nvidia-docker run --rm nvidia/cuda nvidia-smi

Keep running your docker with bash access: sudo nvidia-docker run -ti --rm nvidia/cuda /bin/bash

Building your own docker file

Saving weights to backup_orchid/(.*)weights\n
--> (.*) is for changing text
--> \n to include newline character
For this enable
1. use regular expressions
2. use multi-line matching
@StevenPuttemans
StevenPuttemans / .cpp
Created January 9, 2018 09:13
Depth edge code in OpenCV3.x
#include <iostream>
#include "opencv2/opencv.hpp"
#define DEBUG_OUTPUT 1
using namespace std;
using namespace cv;
Mat own_threshold(Mat conf_map, float lower, float upper){
Mat temp1 = conf_map > lower;
@StevenPuttemans
StevenPuttemans / gist:b2c2b8e877e11c7838e052f6de9dbac5
Created August 23, 2017 11:34
Force images to take as much space as possible in Matlab
set(gca,'LooseInset',get(gca,'TightInset'))
@StevenPuttemans
StevenPuttemans / code.md
Created June 14, 2017 09:40
Create video from frames using FFMPEG

Using FFMPEG a video can be generated from frames using

ffmpeg -r 1/5 -i img%03d.png -c:v libx264 -vf fps=25 -pix_fmt yuv420p out.mp4

Parameters

  • r = ratio if you want to downscale the video
  • i = format of the images, adapt it to your needs!
@StevenPuttemans
StevenPuttemans / doc.md
Last active June 15, 2017 09:36
Darknet - stuff to investigate

Things to investigate considering the darknet framework

Possibility of actually freezing the layers. This can be done by editing the last layer in the *.cfg file and adding the following parameter l.stopbackward = option_find_int_quiet(options, "stopbackward", 0);.

Improving YOLO for close together objects

@StevenPuttemans
StevenPuttemans / command.md
Created June 12, 2017 11:29
Merge darknet upstream changes into a single commit

This can be done with the following commands

git pull --squash origin_PJREDDIE master
git add --all
git commit -m "Merge upstream PJReddie fixes"
git push -f https://gitlab.com/EAVISE/darknet.git master

Of course, if during the pull merge conflicts appear, you need to solve those first.