Skip to content

Instantly share code, notes, and snippets.

View dan-zheng's full-sized avatar
🥛
우유맛

Dan Zheng dan-zheng

🥛
우유맛
View GitHub Profile
@dan-zheng
dan-zheng / README.md
Last active June 23, 2018 02:49
#adjoint expression crasher (https://bugs.swift.org/browse/SR-8087)

The red - lines are produced by direct references to Tensor.dfoo, which doesn't crash.

The green + lines are produced by #adjoint(Tensor.foo), which does crashes.

Introduce user-defined dynamically "callable" types

Introduction

This proposal is a follow-on to [SE-0195 - Introduce User-defined "Dynamic Member

@dan-zheng
dan-zheng / tf_conv_gradients.py
Created February 15, 2018 20:45 — forked from yxlao/tf_conv_gradients.py
TensorFlow Convolution Gradients
"""
Demostrating how to compute the gradients for convolution with:
tf.nn.conv2d
tf.nn.conv2d_backprop_input
tf.nn.conv2d_backprop_filter
tf.nn.conv2d_transpose
This is the scripts for this answer: https://stackoverflow.com/a/44350789/1255535
"""
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dan-zheng
dan-zheng / demo.js
Created February 24, 2017 22:29
An example of using superagent to access Purdue.io API.
const request = require('superagent');
request
.get('http://api.purdue.io/odata/Subjects')
.query({ $select: 'Name,Abbreviation' })
.then((res) => {
const subjects = res.body.value;
console.log(subjects);
});
@dan-zheng
dan-zheng / node-and-npm-in-30-seconds.sh
Created February 9, 2017 21:11 — forked from isaacs/node-and-npm-in-30-seconds.sh
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@dan-zheng
dan-zheng / baseConverter.js
Created October 22, 2016 03:22 — forked from faisalman/baseConverter.js
Convert From/To Binary/Decimal/Hexadecimal in JavaScript
/**
* Convert From/To Binary/Decimal/Hexadecimal in JavaScript
* https://gist.github.com/faisalman
*
* Copyright 2012-2015, Faisalman <[email protected]>
* Licensed under The MIT License
* http://www.opensource.org/licenses/mit-license
*/
(function(){
@dan-zheng
dan-zheng / README.md
Created June 11, 2016 16:51 — forked from dannguyen/README.md
Using Python 3.x and Google Cloud Vision API to OCR scanned documents to extract structured data

Using Python 3 + Google Cloud Vision API's OCR to extract text from photos and scanned documents

Just a quickie test in Python 3 (using Requests) to see if Google Cloud Vision can be used to effectively OCR a scanned data table and preserve its structure, in the way that products such as ABBYY FineReader can OCR an image and provide Excel-ready output.

The short answer: No. While Cloud Vision provides bounding polygon coordinates in its output, it doesn't provide it at the word or region level, which would be needed to then calculate the data delimiters.

On the other hand, the OCR quality is pretty good, if you just need to identify text anywhere in an image, without regards to its physical coordinates. I've included two examples:

####### 1. A low-resolution photo of road signs