This file contains 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
$ for f in `ls *`; do nc=${#f}; nc2=$((10-$nc)); if [ $nc2 -gt 0 ]; then preffix=`printf '0%.0s' $(seq 1 $nc2)`; newf=$preffix$f; mv $f $newf; fi; done |
This file contains 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
convert $f -interpolate nearest-neighbor -interpolative-resize 352x288! $newf |
This file contains 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
for f in *; do file $f | sed 's/.*, \(.*\)x\(.*\),.*/\1x\2/'; done | sort | uniq -c |
This file contains 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
export UID=$(id -u) | |
export GID=$(id -g) | |
docker run --user $UID:$GID \ | |
--workdir="/home/$USER" \ | |
-v "/etc/group:/etc/group:ro" \ | |
-v "/etc/passwd:/etc/passwd:ro" \ | |
-v "/etc/shadow:/etc/shadow:ro" \ | |
-it $DOCKER_IMAGE |
This file contains 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
def parse_args(): | |
parser = argparse.ArgumentParser() | |
parser.add_argument('-d', type=str, help='directory path', dest='dpath') | |
parser.add_argument('-f', type=str, help='filepath', dest='fpath') | |
return parser.parse_args() | |
if __name__ == '__main__': | |
args = parse_args() | |
if not any([args.dpath, args.fpath]): |
This file contains 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
# Code adapted from skimage | |
# https://github.com/riaanvddool/scikits-image/blob/master/skimage/color/delta_e.py#L123 | |
import numpy as np | |
import tensorflow as tf | |
def tf_deg2rad(deg): | |
return (deg / 180) * np.pi | |
def tf_rad2deg(rad): |
This file contains 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
xgb_params = {'objective': 'multi:softmax', | |
'num_class': 19, | |
'tree_method': 'exact', | |
# 'max_bin': 64, | |
'colsample_bytree': 0.75, | |
'subsample': 0.75, | |
# 'lambda': 2, | |
# 'alpha': 2, | |
# 'min_child_weight': 10, | |
# 'max_delta_step': 10, |
This file contains 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 traceback | |
import sys | |
try: | |
pass | |
except Exception as e: | |
traceback_info = ''.join(traceback.format_exception(*sys.exc_info())) | |
logger.info(traceback_info) |
This file contains 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 logging | |
from logging.handlers import RotatingFileHandler | |
import traceback | |
logger = logging.getLogger() | |
logger.setLevel(logging.DEBUG) | |
handler = RotatingFileHandler('app.log', mode='a', maxBytes=50e6, backupCount=2) | |
formatter = logging.Formatter('%(asctime)s,%(message)s', datefmt='%Y-%m-%d %H:%M:%S') | |
handler.setFormatter(formatter) |
This file contains 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
# Install cuda-10.0 because the newest one (for now the version 10.2) mismatchs the tensorflow 1.14.0 requirements | |
wget https://developer.nvidia.com/compute/cuda/10.0/Prod/local_installers/cuda-repo-ubuntu1804-10-0-local-10.0.130-410.48_1.0-1_amd6 | |
dpkg -i cuda-repo-ubuntu1804-10-0-local-10.0.130-410.48_1.0-1_amd6 | |
apt-key add /var/cuda-repo-10-0-local-10.0.130-410.48/7fa2af80.pub | |
apt-get install cuda | |
# This cuda version install nvidia v410 drivers. Remove it. |
NewerOlder