Skip to content

Instantly share code, notes, and snippets.

Train
./darknet detector train data/obj.data cfg/obj.cfg darknet53.conv.74 -map
Test
./darknet detector test data/obj.data cfg/obj.cfg backup/obj_last.weights
Test Multiple from test.txt
./darknet detector test data/obj.data cfg/obj.cfg backup/obj_6000.weights -i 0 -thresh 0.25 -dont_show -ext_output < data/obj/test.txt > detected.txt
Test C++
@ivder
ivder / VideoPerspectiveTransform.py
Created May 13, 2019 03:49
Perspective transform on video
import cv2
import numpy as np
cap = cv2.VideoCapture("test.MP4")
out = cv2.VideoWriter('out.mp4', 0x7634706d, 20.0, (960,540))
if (cap.isOpened()==False):
print("Error reading video")
while (cap.isOpened()):
@ivder
ivder / JetsonCamera.cpp
Last active August 1, 2019 04:36
Opening GoPro with AverMedia ExtremeCap UVC, e-cons , and on board camera on Jetson TX2
/*
Terminal gstreamer pipeline
GoPro - UVC
gst-launch-1.0 v4l2src device="/dev/video1" ! "video/x-raw,width=1920,height=1080,format=YUY2" ! nvvidconv ! 'video/x-raw(memory:NVMM),format=NV12' ! nvvidconv ! xvimagesink
E-cons camera
gst-launch-1.0 v4l2src device="/dev/video1" ! "video/x-raw,width=1920,height=1080,format=UYVY" ! nvvidconv ! 'video/x-raw(memory:NVMM),format=NV12' ! nvoverlaysink
Jetson on board camera
@ivder
ivder / YoloFacialAuthentication.cpp
Last active November 7, 2019 20:11
Facial Authentication using Yolo V3 on Windows 10
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <fstream>
#include <thread>
#include <future>
#include <atomic>
#include <mutex> // std::mutex, std::unique_lock
@ivder
ivder / ClassificationWithIntel.h
Created April 23, 2019 00:29
Intel OpenVIno Classification header
#pragma once
#include "CommonDef.h"
#include "Utils.h"
#include <string>
typedef std::pair<string, float> Prediction;
class ClassificationWithIntelContext;
class ClassificationWithIntel {
@ivder
ivder / ClassificationWithIntel.cpp
Created April 23, 2019 00:28
Intel OpenVino Classification
#include "ClassificationWithIntel.h"
#include "IntelClassification.h"
using namespace IntelVINOLib;
class ClassificationWithIntelContext
{
public:
ClassificationWithIntelContext() {}
~ClassificationWithIntelContext() {}
@ivder
ivder / automlPredictMulti.py
Created April 11, 2019 07:50
Multi images prediction using AutoML generated Model
import sys
import os
from google.cloud import automl_v1beta1
from google.cloud.automl_v1beta1.proto import service_pb2
def get_prediction(content, project_id, model_id):
prediction_client = automl_v1beta1.PredictionServiceClient()
@ivder
ivder / automlCSV.py
Last active April 11, 2019 05:28
program to create CSV file for google automl training data
import os
import pandas as pd
data_folders = next(os.walk('.'))[1]
filenames = [os.listdir(f) for f in data_folders]
files_dict = dict(zip(data_folders, filenames))
base_gcs_path = 'gs://sunlit-cove-237107-vcm/Damage/'
@ivder
ivder / SimpleFaceDetection.py
Created April 9, 2019 06:20
Save frame for every detected face using Haar Cascades
import cv2
import numpy as np
cap = cv2.VideoCapture('test.mp4')
#cap = cv2.VideoCapture(0) #tried using webcam and works
count = 0
while cap.isOpened():
ret,frame = cap.read()
cv2.imshow('window-name',frame)
@ivder
ivder / icon.py
Last active April 5, 2019 05:21
icon
import cv2
import numpy as np
# Input image
input = cv2.imread('0.jpg')
# Get input size
width, height, _ = input.shape
# Desired "pixelated" size
w, h = (64, 64)