Skip to content

Instantly share code, notes, and snippets.

View aaronmarkham's full-sized avatar

Aaron Markham aaronmarkham

View GitHub Profile
# To setup initial repo
export USER=aaronmarkham
export REPO=amazon-sagemaker-examples
export REPO_URL=https://github.com/aws/amazon-sagemaker-examples
git clone --recursive https://github.com/${USER}/${REPO}.git ${USER}-${REPO}
cd ${USER}-${REPO}
git remote add upstream ${REPO_URL}
# Need to add user/email and auth settings steps
@aaronmarkham
aaronmarkham / gist:b3d0c715abca92ccc4b79ed0f19d1916
Last active July 10, 2020 16:56
Raspberry Pi MXNet setup
Requirements:
Raspberry Pi 3B with Stretch.
If you have an existing installation, it must be upgraded to Stretch.
Follow these directions to upgrade: https://www.datenreise.de/en/raspberry-pi-raspbian-update-update-jessie-to-stretch/
Format your SD card with SD Card Formatter.
Download, unzip, then copy contents of the NOOBS (network install) zip file to SD card.
Boot up the Pi and follow the prompts to install the headless Raspbian.
Login to the pi with user `pi` and password `raspberry`.
https://cdn-images-1.medium.com/max/800/1*x5lnmcK-PvjDeXZAfMEsRQ.jpeg
@aaronmarkham
aaronmarkham / inception_predict.py
Created February 14, 2019 17:51
prediction example (from wine_detector on raspberry pi tutorial)
# inception_predict.py
import mxnet as mx
import numpy as np
import cv2, os, urllib
from collections import namedtuple
Batch = namedtuple('Batch', ['data'])
# Load the symbols for the networks
with open('synset.txt', 'r') as f:

Installation Instructions for MXNet-$binding on $OS

The following guide will help you install MXNet-$binding on $OS.

Prerequisites

The following are required prerequisites:

  1. Install $prerequisite:
@aaronmarkham
aaronmarkham / gluon-export-model
Created January 30, 2018 22:58
shows a problem with exporting then importing a model in gluon
import mxnet as mx
from mxnet.test_utils import download
from mxnet.gluon.model_zoo import vision as models
gpus = 0
contexts = [mx.gpu(i) for i in range(gpus)] if gpus > 0 else [mx.cpu()]
deep_dog_net = models.squeezenet1_1(prefix='deep_dog_', classes=2)
deep_dog_net.collect_params().initialize(ctx=contexts)
download('https://apache-mxnet.s3-accelerate.amazonaws.com/gluon/models/deep-dog-5a342a6f.params',
@aaronmarkham
aaronmarkham / alexnet_codes
Created April 4, 2017 23:43
This list of codes is useful for looking up results from a neural network trained on AlexNet
{
0: 'tench, Tinca tinca',
1: 'goldfish, Carassius auratus',
2: 'great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias',
3: 'tiger shark, Galeocerdo cuvieri',
4: 'hammerhead, hammerhead shark',
5: 'electric ray, crampfish, numbfish, torpedo',
6: 'stingray',
7: 'cock',
8: 'hen',
Trying example: test_relu(self=<__main__.TestRelu testMethod=test_relu>, X=array([[-0.7635088 ],
[-0.24276257]], dtype=float32), gc=, dc=[])
Trying example: test_relu(self=<__main__.TestRelu testMethod=test_relu>, X=array([[ 0. , 1. ],
[ 0.20600842, -0.92744243]], dtype=float32), gc=, dc=[])
Trying example: test_relu(self=<__main__.TestRelu testMethod=test_relu>, X=array([ 0.22169138, -0. , 0. , 0. ], dtype=float32), gc=, dc=[])
Trying example: test_relu(self=<__main__.TestRelu testMethod=test_relu>, X=array([-0.], dtype=float32), gc=, dc=[])
Trying example: test_relu(self=<__main__.TestRelu testMethod=test_relu>, X=array([ 0.], dtype=float32), gc=, dc=[])
Trying example: test_relu(self=<__main__.TestRelu testMethod=test_relu>, X=array([[-0.28297934],
[ 0.20971532],
[ 0. ]], dtype=float32), gc=, dc=[])