This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Verifying that +sj7 is my openname (Bitcoin username). https://onename.com/sj7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
graph = tf.Graph() | |
with graph.as_default(): | |
train_inputs = tf.placeholder(tf.int32, shape=[batch_size]) | |
train_labels = tf.placeholder(tf.int32, shape=[batch_size, 1]) | |
valid_dataset = tf.constant(valid_examples, dtype=tf.int32) | |
with tf.device('/cpu:0'): | |
embeddings = tf.Variable(tf.random_uniform([vocabulary_size, embedding_size], -1.0, 1.0)) | |
embed = tf.nn.embedding_lookup(embeddings, train_inputs) | |
nce_weights = tf.Variable(tf.truncated_normal([vocabulary_size, embedding_size], stddev=1.0 / math.sqrt(embedding_size))) | |
nce_biases = tf.Variable(tf.zeros([vocabulary_size])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with tf.Session(graph=graph) as session: | |
init.run() | |
average_loss = 0 | |
for step in range(10001): | |
batch_inputs, batch_labels = generate_batch(batch_size, num_skips, skip_window) | |
feed_dict = {train_inputs: batch_inputs, train_labels: batch_labels} | |
_, loss_val, normalized_embeddings_np = session.run([optimizer, loss, normalized_embeddings], feed_dict=feed_dict) | |
average_loss += loss_val | |
final_embeddings = normalized_embeddings.eval() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
events {} | |
http { | |
upstream pgdb { | |
postgres_server urlshortnertestdb.cccccccccccc.us-west-2.rds.amazonaws.com dbname=redirect user=root password=password; | |
} | |
server { | |
listen 80; | |
server_name localhost; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
sudo apt-get update | |
sudo apt-get install -y --no-install-recommends \ | |
build-essential \ | |
cmake \ | |
git \ | |
libgoogle-glog-dev \ | |
libprotobuf-dev \ | |
protobuf-compiler \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM tensorflow/tensorflow:1.5.0-gpu | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
python-pip \ | |
protobuf-compiler \ | |
python-pil \ | |
python-lxml \ | |
python-numpy \ | |
python-scipy \ | |
python-dev \ | |
python-pip \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#this is an Image of size 140x140. We will assume it to be black and white (ie only one channel, it would have been 140x140x3 for rgb) | |
image = readImage() | |
#We will break the Image into 7 coloumns and 7 rows and process each of the 49 different parts independently | |
NoOfCells = 7 | |
#we will try and predict if an image is a dog, cat, cow or wolf. Therfore the number of classes is 4 | |
NoOfClasses = 4 | |
threshold = 0.7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
image = readImage() | |
NoOfCells = 7 | |
NoOfClasses = 4 | |
threshold = 0.7 | |
step = height(image)/NoOfCells | |
prediction_class_array = new_array(size(NoOfCells,NoOfCells,NoOfClasses)) | |
predictions_bounding_box_array = new_array(size(NoOfCells,NoOfCells,NoOfCells,NoOfCells)) | |
final_predictions = [] | |
for (i<0; i<NoOfCells; i=i+1): | |
for (j<0; j<NoOfCells;j=j+1): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests, os, sys | |
model_id = os.environ.get('NANONETS_MODEL_ID') | |
api_key = os.environ.get('NANONETS_API_KEY') | |
image_path = sys.argv[1] | |
url = 'https://app.nanonets.com/api/v2/ObjectDetection/Model/' + model_id + '/LabelFile/' | |
data = {'file': open(image_path, 'rb'), 'modelId': ('', model_id)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import picamera, os | |
from PIL import Image, ImageDraw | |
camera = picamera.PiCamera() | |
camera.capture('image1.jpg') | |
os.system("xdg-open image1.jpg") |
OlderNewer