Skip to content

Instantly share code, notes, and snippets.

View wermarter's full-sized avatar
🐹
lọ mọ

Hà Minh Chiến wermarter

🐹
lọ mọ
View GitHub Profile
import tensorflow as tf
import tflearn
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm
import cv2
import tflearn.datasets.mnist as mnist
trainX, trainY, testX, testY = mnist.load_data(one_hot=True)
import tensorflow as tf
import tflearn
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm
import tflearn.datasets.mnist as mnist
trainX, trainY, testX, testY = mnist.load_data(one_hot=True)
TENSORBOARD_DIR='./tmp/tflearn/vae'
@wermarter
wermarter / myVAE.py
Last active June 22, 2017 11:27
my implementation of Variational AutoEncoder with tflearn
import tensorflow as tf
import tflearn
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm
import tflearn.datasets.mnist as mnist
trainX, trainY, testX, testY = mnist.load_data(one_hot=True)
TENSORBOARD_DIR='./logs/vae'
#include "opencv2/core/core.hpp"
#include "opencv2/contrib/contrib.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <iostream>
#include <fstream>
#include <sstream>
using namespace cv;
using namespace std;
#include <opencv2/core.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/objdetect/objdetect.hpp>
#include <iostream>
#include <string>
using namespace cv;
using namespace std;
@wermarter
wermarter / CTV_Vietcap.py
Created April 25, 2017 09:25
audio transcriber for Vietcap using wit.ai
import speech_recognition as sr
import os
class Listenner():
def __init__(self, api_key):
self.api_key = api_key
self.R = sr.Recognizer()
def recognize(self, AUDIO_FILE):
with sr.AudioFile(AUDIO_FILE) as source:
@wermarter
wermarter / ForBin.cs
Created February 4, 2017 12:17
Shortcut Webbrowser
using Microsoft.Win32;
using System.Diagnostics;
using System.Windows.Forms;
namespace ForBin
{
public partial class Form1 : Form
{
private const int CP_NOCLOSE_BUTTON = 0x200;
protected override CreateParams CreateParams
import cv2
import numpy as np
img = cv2.imread('me.png', 1)
edges = cv2.Canny(cv2.GaussianBlur(img, (5, 5), 0), 50, 200, apertureSize=3)
cv2.imshow('Edges', edges)
lines = cv2.HoughLines(edges, 1, np.pi/200, 200)
for data in lines:
rho, theta = data[0]
a = np.cos(theta)
@wermarter
wermarter / python_opencv_CustomFilter.py
Created January 26, 2017 07:10
Using Filter2D with SobelX
import numpy as np
import cv2
img = cv2.imread('knk.jpg', 1)
img = cv2.resize(img, (0, 0), fx=0.5, fy=0.5)
myFilter = np.array([
[-1, 0, 1],
[-2, 0, 2],
[-1, 0, 1]
]) # Sobel X
@wermarter
wermarter / python_imagesearch_MAL.py
Created January 25, 2017 14:51
MAL Basic Image Search Engine
import pickle, cv2, sqlite3
import numpy as np
class BGRHist:
def __init__(self, bins):
self.bins = bins
def describe(self, img):
hist = cv2.calcHist([img], range(3), None, self.bins, [0, 256]*3)
cv2.normalize(hist, hist)
return hist.flatten()
class Searcher: