This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
import torchvision | |
import torch.utils.data | |
from torchvision import transforms | |
from torch.backends import cudnn | |
# some hyperparameters setting | |
use_gpu = True | |
train_batch_size = 64 | |
val_batch_size = 64 |
Commands:
./tst.py &
: run in backgroundnohup ./tst.py &
: don't print output in stdout, and set the parent process as #0 process.nohup
means No hangup signal.setsid ./tst.py &
: print output in stdout, set the parent process as #1 process.disown %1
: change the parent process of a background process- hot key
ctrl+z
: suspend foreground process bg %1
: trun foreground job #1 to background, equal tokill -CONT -pid_value
bg
: trun all foreground job to backgroundfg %1
: trun background job to foreground
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
from matplotlib import animation | |
from IPython.display import display, HTML | |
import numpy as np | |
def plot_sequence_images(image_array): | |
''' Display images sequence as an animation in jupyter notebook | |
Args: | |
image_array(numpy.ndarray): image_array.shape equal to (num_images, height, width, num_channels) |
- 安装服务:
wget --no-check-certificate https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocks.sh
chmod +x shadowsocks.sh
./shadowsocks.sh 2>&1 | tee shadowsocks.log
- 加速1
OlderNewer