Skip to content

Instantly share code, notes, and snippets.

@guoxiaolu
guoxiaolu / drop.py
Last active Jul 28, 2020
高空抛物 drop judge
View drop.py
import os
import cv2
import numpy as np
from skimage.feature import blob_dog, blob_log, blob_doh
from math import sqrt
from time import time
from multiprocessing import Pool, Queue
def GetDiff(img0,img1,thresh_diff_pix):
img_diff=img0-img1
View gallery
@guoxiaolu
guoxiaolu / es instruction
Last active Apr 18, 2018
es instruction
View es instruction
curl -s -XPUT 'http://localhost:9200/image_search_tmp?pretty' -d '{
"settings" : {
"analysis": {
"analyzer": {
"payload_analyzer": {
"type": "custom",
"tokenizer":"whitespace",
"filter":"delimited_payload_filter"
}
}
View gist:642f46438abc8a260aa91213f9508a3b
digraph G{
node [shape=record]
a[label="ResNet50|{input:|output:}|{(224, 224, 3)|(2048)}"]
b[label="InceptionV3|{input:|output:}|{(299, 299, 3)|(2048)}"]
#c[label="Xception|{input:|output:}|{(299, 299, 3)|(2048)}"]
Merge[label="Merge|{input:|output:}|{(2, 2048)|(4096)}"]
Dropout[label="Dropout|Rate:|0.5"]
Output[label="Output|{input:|output:}|{(4096)|(365)}"]
Image -> a -> Merge
Image -> b -> Merge
View gist:069a4fd14505d4b4ed1839e250614585
# !/usr/bin/python
# coding=utf-8
from PIL import Image
import os
import sys
def is_jpg(filename):
try:
i=Image.open(filename)
return i.format =='JPEG'
View gist:b16c5eac627d9d17d153484b51401a60
from theano import function, config, shared, tensor
import numpy
import time
vlen = 10 * 30 * 768 # 10 x #cores x # threads per core
iters = 1000
rng = numpy.random.RandomState(22)
x = shared(numpy.asarray(rng.rand(vlen), config.floatX))
f = function([], tensor.exp(x))
@guoxiaolu
guoxiaolu / gist:2ed546e1e88d27afd82e6e1442b8d7a9
Created Sep 14, 2017
how to use dot to output an image
View gist:2ed546e1e88d27afd82e6e1442b8d7a9
digraph G{
node [shape=record]
a[label="ResNet50|{input:|output:}|{(224, 224, 3)|(2048)}"]
b[label="InceptionV3|{input:|output:}|{(299, 299, 3)|(2048)}"]
#c[label="Xception|{input:|output:}|{(299, 299, 3)|(2048)}"]
Merge[label="Merge|{input:|output:}|{(2, 2048)|(4096)}"]
Dropout[label="Dropout|Rate:|0.5"]
Output[label="Output|{input:|output:}|{(4096)|(365)}"]
Image -> a -> Merge
Image -> b -> Merge