Skip to content

Instantly share code, notes, and snippets.

View wkcn's full-sized avatar
🐳
Tell Your World 🎵

JackieWu wkcn

🐳
Tell Your World 🎵
  • China
View GitHub Profile
@wkcn
wkcn / RPSAI20140722.cpp
Last active August 29, 2015 14:04
A RPS AI
// Ver 1.1
// 更新时间:2014/7/22 18:36
//更改了错误参数,对有规律的AI胜率较大
//最差情况一般胜率不低于33.3%
namespace RPS
{
enum state { rock = 0, paper = 1, scissors = 2, blank = 3 };
struct player
{
@wkcn
wkcn / rpstest.cpp
Last active August 29, 2015 14:04
RPS TEST
#include<vector>
#include<iostream>
#include<string>
#include <algorithm>
using namespace std;
namespace RPS
{
enum state { rock = 0, paper = 1, scissors = 2, blank = 3 };
struct player
@wkcn
wkcn / simpleTrans.py
Created March 3, 2015 11:33
一个简单的单词翻译
#-*- coding:utf-8 -*-
import urllib2
def GetHtml(word):
address = 'http://cn.bing.com/dict/search?&q=' + word;
try:
html = urllib2.urlopen(address).read().decode('utf-8')
return html
except:
return ''
@wkcn
wkcn / gist:16c671e4a0684efdf285
Created March 14, 2016 11:14
一个简单的英语音频分割
#coding=utf-8
from pydub import AudioSegment
from pydub.silence import split_on_silence
import numpy as np
import matplotlib.pyplot as plt
import pyaudio
import os
file_folder = 'D:/Mirai/English/3L英语第二册/'
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import pyplot as plt
import numpy as np
try:
import Queue
except:
import queue as Queue
# total time
T = 3
@wkcn
wkcn / test.py
Last active March 3, 2018 09:29
Testing Code for MultiProposal
import mxnet as mx
from mxnet import nd
import numpy as np
import time
np.random.seed(1234)
feature_stride = 16
scales = (8, 16, 32)
ratios = (0.5, 1, 2)
@wkcn
wkcn / test_multi_proposal.py
Created March 9, 2018 07:43
Multi-Proposal Operator Test (cpu implementation) for MXNet
import mxnet as mx
from mxnet import nd
import numpy as np
feature_stride = 16
scales = (8, 16, 32)
ratios = (0.5, 1, 2)
rpn_pre_nms_top_n = 12000
rpn_post_nms_top_n = 2000
threshold = 0.7
@wkcn
wkcn / countoptime_mx.py
Created May 13, 2018 08:04
CountOPTime-mx
import mxnet as mx
import time
from distutils.util import strtobool
BT = time.time()
class CountTimeOP(mx.operator.CustomOp):
def __init__(self, first, cname):
super(CountTimeOP, self).__init__()
self.first = first
@wkcn
wkcn / mnist_count_time.py
Created May 13, 2018 08:06
mnist_count_time
import mxnet as mx
import count_time
mnist = mx.test_utils.get_mnist()
# Fix the seed
mx.random.seed(42)
# Set the compute context, GPU is available otherwise CPU
ctx = mx.gpu() if mx.test_utils.list_gpus() else mx.cpu()
@wkcn
wkcn / count_time_for_mobula_op.py
Last active September 10, 2018 09:04
Count Time for MobulaOP
import mobula_op
import mxnet as mx
import numpy as np
from mobula_op.test_utils import assert_almost_equal
import time
def check_conv(data, weight, bias, kernel, stride, dilate, pad, num_filter, no_bias, conv):
data_mx = data.copy()
weight_mx = weight.copy()
bias_mx = bias.copy()