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
filename = "vector_strip2_256x256_over32/vector_strip2_8790.TIF" | |
file1 = "Fold_0/"+filename | |
file2 = "Gts/"+filename | |
from skimage import io | |
import numpy as np | |
import matplotlib.pyplot as plt | |
# The prediction |
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
# Train NN on some specific task (perhaps looking at some type of data) | |
# starts with ImageNet weights, but these are changed accordingly to what your task needs. | |
# later we can load these weights into the SiameseUnet model as a specific encoder (instead of using the Imagenet defaults). | |
import matplotlib, os, glob, fnmatch | |
if not('DISPLAY' in os.environ): | |
matplotlib.use("Agg") # when running over ssh on server | |
# FORCE CPU | |
#import os |
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
mogrify -font Liberation-Sans -fill white -undercolor '#00000080' -pointsize 26 -gravity NorthEast -annotate +10+10 %t *.jpg |
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
# [SETUP, get these:] | |
# built_graph/yolo.meta | |
# built_graph/yolo.pb | |
# (using # flow --model cfg/yolo.cfg --load bin/yolo.weights --savepb) | |
from darkflow.net.build import TFNet | |
import numpy | |
import os, fnmatch, random | |
import cv2 |
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
from keras.models import Sequential | |
from keras.layers import Dense, Conv2D, MaxPooling2D, Flatten | |
model = Sequential() | |
model.add(Conv2D(32, (3,3), activation='relu', input_shape=input_shape)) | |
model.add(Flatten()) | |
model.add(Dense(10)) | |
model.summary() |
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
# link https://github.com/platanus/openface-api | |
(had this before) | |
(installed docker) | |
docker pull bamos/openface | |
git clone https://github.com/platanus/openface-api.git | |
cd openface-api | |
git init | |
git add --all |
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 os, fnmatch, random | |
import json | |
from pprint import pprint | |
def load(path, keywords_find, keywords_exclude): | |
# Frames to crops | |
files = sorted(os.listdir(path)) | |
#print("files",len(files), files[0:10]) | |
files = fnmatch.filter(files, '*.json') | |
random.shuffle(files) |
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
ctrl + z = will suspend the currently foregrounded program | |
jobs = see suspended / running jobs with number | |
bg = will run in background (the most recently suspended program) | |
(use bg %2 with the job number, which you can check with jobs) | |
fg = will bring to foreground the most recently suspended program |
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
# thanks to https://github.com/bapoczos/ArtML/blob/master/fast-style-transfer/transform_video.py | |
# thanks to Barnabas Poczos and Gene Kogan | |
import subprocess, shutil | |
import os, fnmatch | |
in_args = [ | |
'ffmpeg', | |
'-i', in_path, | |
'%s/frame_%%d.png' % in_dir |
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
#when facing similar issue to the one mentioned at https://github.com/tensorflow/tensorflow/issues/1439 | |
import tensorflow as tf | |
print("Count of global variables", len(tf.global_variables())) | |
print("Count of graph elements",len(tf.get_default_graph().get_operations())) |