Skip to content

Instantly share code, notes, and snippets.

View kushalvyas's full-sized avatar
😄
Focusing

Kushal Vyas kushalvyas

😄
Focusing
View GitHub Profile
@kushalvyas
kushalvyas / crop.py
Created January 19, 2018 10:30
OpenCV Cropping Utility
'''
Opencv Image Cropper
Commands:
s : Overwrite & Save image
left-arrow : previous
right-arrow : next
'''
import cv2
import glob
@kushalvyas
kushalvyas / watch_video.js
Last active October 31, 2023 07:15
JS for Camera capture from browser
/**
* Created by kushal
*
* Usage :
* To access local system webcam on the internet/
* Couple of points to be remembered:
*
* - Accessing the webcam using HTML5 and JS requires permission from
* the browser. The url of the file has to be a valid one. Url such as file:/// in your browser will not permit the browser to access local webcam.
* - Whereas, an http or https url will surely make a paved way for it. Hence, while developing, one can use Xampp, Wamp or the LAMP Stack.
@kushalvyas
kushalvyas / index.html
Last active September 8, 2017 17:32
Sample Index File for Camera function
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Camera Feed : Color Tracking</title>
<!--load css ... use bootstrap-->
<link href="../../dependencies/css/bootstrap.css" rel="stylesheet">
<script src="watch_video.js"></script>
</head>
<body bgcolor="#bdb76b">
layer {
name: "data"
type: "Python"
top: "data"
top: "label"
python_param {
module: "voc_layers"
layer: "SBDDSegDataLayer"
param_str: "{\'sbdd_dir\': \'../../data/sbdd/dataset\', \'seed\': 1337, \'split\': \'train\', \'mean\': (104.00699, 116.66877, 122.67892)}"
}

Virtualization in clouds

Shortened URL : goo.gl/r249Vg

  1. What is virtualization ? There are 4 types
    • hardware virtualization : When VM is directly installed on a machine
    • operating system virtualization : When VM is directly installed on the host OS
    • server virtualization :
    • storage virtualization : Where physical storage is abstracted through another interface
@kushalvyas
kushalvyas / train_model.prototxt
Created January 20, 2017 17:35
Architecture of AlexNET
name: "CaltechNET"
layer {
name: "data"
type: "Data"
top: "data"
top: "label"
include {
phase: TRAIN
}
transform_param {
@kushalvyas
kushalvyas / 8queens.py
Created September 8, 2016 19:44
8 queens problem
"""
check out http://kushalvyas.github.io/gen_8Q.html#gen_8Q
@file : queens.py
Illustration of 8 queens using GA - evolution
"""
import numpy as np
@kushalvyas
kushalvyas / example_population.py
Created September 8, 2016 18:43
Example population and chromosome generation for http://bitsmakemecrazy.com/gen_8Q.html#gen_8Q
def generateChromosome():
# randomly generates a sequence of board states.
global nQueens
init_distribution = np.arange(nQueens)
np.random.shuffle(init_distribution)
return init_distribution
def generatePopulation(population_size = 100):
global POPULATION
def developVocabulary(self,n_images, descriptor_list, kmeans_ret = None):
"""
Each cluster denotes a particular visual word
Every image can be represeted as a combination of multiple
visual words. The best method is to generate a sparse histogram
that contains the frequency of occurence of each visual word
Thus the vocabulary comprises of a set of histograms of encompassing
all descriptions for all images
import cv2
import numpy as np
from glob import glob
from sklearn.cluster import KMeans
from sklearn.svm import SVC
from sklearn.preprocessing import StandardScaler
from matplotlib import pyplot as plt
class ImageHelpers:
def __init__(self):