Skip to content

Instantly share code, notes, and snippets.

@foolishflyfox
foolishflyfox / git_notebook.md
Last active December 26, 2018 09:28
The usage of git, just as a notebook of progit BOOK

Ignoring Files

# ignore files whose suffix is .o or .a
*.[oa]

# you can negate a pattern by starting it with an exclation point(!)
!hello.o
@foolishflyfox
foolishflyfox / cv_framework_detailed.py
Last active December 24, 2018 07:40
Pytorch Computer Vision Framework (Detailed)
import torch
import torchvision
import torch.utils.data
from torch.backends import cudnn
from torchvision import transforms
# some hyperparameters setting
use_gpu = True
train_batch_size = 64
val_batch_size = 64
@foolishflyfox
foolishflyfox / argparse_demo.py
Last active December 27, 2018 14:05
Demo of argparse usage
#!/usr/bin/env python
import argparse
parser = argparse.ArgumentParser(
description='Some description about this script',
formatter_class=argparse.ArgumentDefaultsHelpFormatter, # show default value
)
# add required option. Note: required option can't with default parameter
parser.add_argument('info', type=str, help="required option")
@foolishflyfox
foolishflyfox / CodeSnippet.md
Last active April 4, 2019 08:37
Gist Classify
@foolishflyfox
foolishflyfox / disp_multiple_images.py
Last active December 20, 2018 11:33 — forked from soply/disp_multiple_images.py
Plot multiple images with matplotlib in a single figure. Titles can be given optionally as second argument.
import matplotlib.pyplot as plt
import numpy as np
import PIL
def show_images(images, rows = 1, titles = None):
"""Display a list of images in a single figure with matplotlib.
Parameters
---------
images: List of np.arrays compatible with plt.imshow.