Skip to content

Instantly share code, notes, and snippets.

@kyamagu
kyamagu / Caffe2+MNIST+tutorial.ipynb
Last active December 11, 2017 07:32
Caffe2 MNIST tutorial
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kyamagu
kyamagu / SqueezeNet.ipynb
Created December 11, 2017 06:46
Caffe2 deploy tutorial
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kyamagu
kyamagu / Linear-regression.ipynb
Created December 11, 2017 06:12
Caffe2 Linear regression tutorial
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kyamagu
kyamagu / dogs-vs-cats.ipynb
Last active June 17, 2019 20:29
Example of Caffe2 fine-tuning
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kyamagu
kyamagu / Caffe2-tutorials.md
Created October 14, 2017 08:35
Personal note on running caffe2 tutorials.

Caffe 2 tutorials

Running a tutorial docker image.

docker run -it --rm -p 8888:8888 caffe2ai/caffe2:c2v0.8.1.cpu.full.ubuntu14.04 \
  sh -c "jupyter notebook --no-browser --ip 0.0.0.0 --allow-root /caffe2/caffe2/python/tutorials"
  • --rm option deletes the docker instance after exits. Remove --rm if needed to interrupt the session.
@kyamagu
kyamagu / Makefile
Created August 29, 2017 02:34
Tasks to maintain a python package
# Tasks to maintain python package.
#
# See https://packaging.python.org/tutorials/distributing-packages/
test:
tox
upload:
python setup.py bdist_wheel --universal
twine upload dist/*

SMBNetFS

Install and setup

sudo apt-get install smbnetfs
mkdir ~/.smb
cp /etc/smbnetfs/smbnetfs.conf ~/.smb
cp /etc/samba/smb.conf ~/.smb
@kyamagu
kyamagu / binary_classification_utils.py
Created June 15, 2017 13:12
Helper for binary classification training in PyTorch
"""
Use in PyTorch.
"""
def accuracy(output, target):
"""Computes the accuracy for multiple binary predictions"""
pred = output >= 0.5
truth = target >= 0.5
acc = pred.eq(truth).sum() / target.numel()
return acc
@kyamagu
kyamagu / ubuntu-setup.md
Last active August 3, 2021 14:18
Ubuntu in ActiveDirectory environment

Ubuntu setup

Setup instructions for the Ubuntu 16.04 workstations and servers in the laboratory environment. Replace systemctl with Upstart start|stop for Ubuntu 14.04.

Passwordless sudo

sudo tee /etc/sudoers.d/administrator <<EOF
administrator ALL=(ALL) NOPASSWD: ALL
EOF
@kyamagu
kyamagu / build_celeba_lmdb.py
Created December 12, 2016 06:52
Script to convert CelebA dataset to LMDB format
#!/usr/bin/env python
'''
Example:
python data/celeba/scripts/build_dataset.py \
--output_dir data/celeba/
./build/tools/compute_image_mean \
data/celeba/train-images.lmdb \
data/celeba/mean.binaryproto