Setup instructions for the Ubuntu 16.04 workstations and servers in the laboratory environment. Replace systemctl with Upstart start|stop for Ubuntu 14.04.
sudo tee /etc/sudoers.d/administrator <<EOF
administrator ALL=(ALL) NOPASSWD: ALL
EOF| import lmdb | |
| import leveldb | |
| def lmdb_reader(filename, **kwargs): | |
| with lmdb.open(filename, readonly=True, create=False, **kwargs) as env: | |
| with env.begin() as txn: | |
| with txn.cursor() as cursor: | |
| for key, value in cursor: | |
| yield key, value |
| // Caffe proto converter. | |
| // | |
| // Build. | |
| // | |
| // mex -I/path/to/matlab-lmdb/include ... | |
| // -I/path/to/caffe/build/src/caffe/proto ... | |
| // caffe_proto_.cc ... | |
| // /path/to/caffe/build/src/caffe/proto/caffe.pb.o ... | |
| // -lprotobuf CXXFLAGS="$CXXFLAGS -std=c++11" | |
| // |
| # set SGE environment if exists | |
| ACTIVE_JOBS_DIR=/var/spool/gridengine/execd/$(hostname)/active_jobs/ | |
| if [ -d $ACTIVE_JOBS_DIR ]; then | |
| PARENT_PID=$(ps -p $(ps -p $$ -o ppid --no-header) -o ppid --no-header) | |
| for job_dir in $(ls -1 $ACTIVE_JOBS_DIR); do | |
| JOB_PID=$(cat $ACTIVE_JOBS_DIR$job_dir/job_pid) | |
| if [ $JOB_PID -eq $PARENT_PID ]; then | |
| echo . $ACTIVE_JOBS_DIR$job_dir/environment | |
| . $ACTIVE_JOBS_DIR$job_dir/environment | |
| break |
| name: "celeba_alexnet_independent" | |
| layer { | |
| name: "data" | |
| type: "Data" | |
| top: "data" | |
| include { | |
| phase: TRAIN | |
| } | |
| transform_param { | |
| mirror: true |
| ''' | |
| Plot iteration information from the log file. | |
| Usage | |
| python examples/message_passing/plot_iteration.py solver.log | |
| ''' | |
| import argparse |
| #!/usr/bin/env python | |
| '''Caffe ResNet NetSpec example. | |
| Compatible with Kaiming He's pre-trained models. | |
| https://github.com/KaimingHe/deep-residual-networks | |
| ''' | |
| import sys |
| #!/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 |
| """ | |
| 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 |