Skip to content

Instantly share code, notes, and snippets.

@guoxiaolu
guoxiaolu / gist:2ed546e1e88d27afd82e6e1442b8d7a9
Created September 14, 2017 09:15
how to use dot to output an image
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
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))
# !/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'
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
@guoxiaolu
guoxiaolu / es instruction
Last active April 18, 2018 03:14
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"
}
}
@guoxiaolu
guoxiaolu / drop.py
Last active July 28, 2020 02:29
高空抛物 drop judge
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