Skip to content

Instantly share code, notes, and snippets.

View moskomule's full-sized avatar
🎯
Focusing

Ryuichiro Hataya moskomule

🎯
Focusing
View GitHub Profile
@moskomule
moskomule / Dockerfile
Created October 10, 2017 15:23
easymecab
FROM ubuntu:latest
RUN apt-get update
RUN apt-get install -y mecab libmecab-dev mecab-ipadic-utf8
@moskomule
moskomule / tinyimagenet.sh
Created November 6, 2017 10:48
tiny imagenet downloader
#!/bin/bash
# download and unzip dataset
#wget http://cs231n.stanford.edu/tiny-imagenet-200.zip
unzip tiny-imagenet-200.zip
current="$(pwd)/tiny-imagenet-200"
# training data
cd $current/train
@moskomule
moskomule / README.md
Created August 29, 2018 07:23
Upload to Google drive from servers
wget -O grive https://docs.google.com/uc?id=0B3X9GlR6EmbnQ0FtZmJJUXEyRTA
chmod 755 grive # not sure if it's necessary
./gdrive upload [--recursive] NAME
@moskomule
moskomule / Rop.py
Created September 18, 2018 08:41 — forked from apaszke/Rop.py
def Rop(y, x, v):
"""Computes an Rop.
Arguments:
y (Variable): output of differentiated function
x (Variable): differentiated input
v (Variable): vector to be multiplied with Jacobian from the right
"""
w = torch.ones_like(y, requires_grad=True)
return torch.autograd.grad(torch.autograd.grad(y, x, w), w, v)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@moskomule
moskomule / README.md
Last active March 25, 2019 06:11
webvision

utility for downloading webvision2018 dataset

Requires gnu parallel and aria2c. Both can be downloaded via brew

cat results/*/*.json | grep -o -E 'args": "[^"]+' | grep -o -E '\-\-loss.*' >f1.txt
cat results/*/*.json | grep -o -E 'args": "[^"]+' | grep -o -E '\-\-dataset[^\-]+' > f2.txt
cat results/*/*.json | grep -o -E 'miou_test": \[\[[^"]+' | grep -o -E '29, [^]]+' > f3.txt
paste f1.txt f2.txt f3.txt | sed -e 's/--loss/|/g' | sed -e 's/--batch_size/|/g' | sed -e 's/29,/|/g'| sed -e 's/--dataset/|/g' | sort
#
# | ce | 1 | sbd | 0.7214421629905701
# | ce | 1 | voc | 0.6946691870689392
# | ce | 2 | sbd | 0.7422053217887878
# | ce | 2 | voc | 0.7283321619033813
@moskomule
moskomule / image_folder_tar.py
Created July 26, 2019 04:30 — forked from rwightman/image_folder_tar.py
PyTorch ImageFolder style dataset for reading directly from tarfile
import torch.utils.data as data
import os
import re
import torch
import tarfile
from PIL import Image
IMG_EXTENSIONS = ['.png', '.jpg', '.jpeg']
@moskomule
moskomule / README.md
Created April 21, 2020 11:45 — forked from sevko/README.md
simple Python raytracer

raytracer

A simple Python raytracer that supports spheres with configurable "material" properties (base color and a bunch of light coefficients). To generate a raytraced image of the pre-defined scene, run: python raytracer.py and open image.ppm with a PPM-compatible viewer (eog works fine on Linux):

raytraced spheres

acknowledgements

I found the following resources extremely helpful:

@moskomule
moskomule / fourier.ipynb
Created July 23, 2020 12:33
Image Fourier transforms with PyTorch
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.