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 cv2 | |
def get_font_point_and_scale(text, x, y, h, w, thickness, font): | |
(text_width, text_height) = cv2.getTextSize(text, font, 1.0, thickness)[0] | |
scalex = w/text_width | |
scaley = h/text_height | |
scale = min(scalex, scaley) | |
marginx = 0 if scale == scalex else int(w *(scalex-scale)/scalex*0.5) | |
marginy = 0 if scale == scaley else int(h *(scaley-scale)/scaley*0.5) |
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
#!/bin/bash | |
line_num=0 | |
name_list=() | |
cat list.txt | while read -r line | |
do | |
echo $line | |
mv ./$line ./../file/$line | |
((line_num++)) | |
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
""" | |
load model | |
""" | |
def load_model(model_dir): | |
start = time.time() | |
model_exp = os.path.expanduser(model_dir) | |
if (os.path.isfile(model_exp)): | |
print('Model filename: %s' % model_exp) | |
with gfile.FastGFile(model_exp, 'rb') as f: |
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
pip install pyinstaller | |
pip install --upgrade pyinstaller | |
pyinstaller -F --name program_name --noconsole my_program.py |
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
######################################## | |
#Ubuntu: 16.04 | |
#NVIDIA Driver: 384.111 ver | |
#NVIDIA CUDA: 9.0.176 ver | |
#NVIDIA CUDNN: 7.0 ver | |
#tensorflow-gpu: 1.6.0 ver | |
######################################## | |
# Remove anything linked to nvidia | |
sudo apt-get remove --purge nvidia* |
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
# status initialize | |
import os | |
os.environ['CUDA_VISIBLE_DEVICES'] = '1' | |
# out of memory | |
import tensorflow as tf | |
with tf.Graph().as_default(): | |
gpu_options = tf.GPUOptions(allow_growth=True) |
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
#!/bin/bash | |
cnt=0 | |
for NAME in *; do | |
if [[ -d $NAME ]]; then | |
NEWNAME=`echo $cnt`; | |
`echo $NAME $NEWNAME` | |
mv $NAME $NEWNAME; | |
((cnt++)) | |
fi |
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
#!/bin/bash | |
# filename: aaa-01.jpg, bbb-01.jpg | |
for file in *.jpg ; do | |
arr=(${file//-/ }) | |
dir=dir/${arr[0]} | |
[[ -d $dir ]] || mkdir -p "$dir" | |
mv "$file" "$dir" | |
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
import sys | |
import os | |
sys.path.append(os.getcwd()) |
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
#!/usr/bin/python | |
import sys | |
import os | |
import shutil | |
from wand.image import Image | |
name = raw_input("New Name: ") | |
files = os.listdir(sys.argv[1]) |
NewerOlder