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 argparse | |
import time | |
start_time=time.time(); | |
################## Argument Parsing ##################################### | |
parser=argparse.ArgumentParser(); | |
parser.add_argument('-s','--solver', default='', type=str); # if empty, solver is created, else read | |
parser.add_argument('-res', '--resume_from', default='', type=str); #if not empty, resumes training from given file | |
parser.add_argument('-ft', '--finetune_from', default='', type=str); |
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
#in the name of God the most compassionate the most merciful | |
# added mean subtraction so that, the accuracy can be reported accurately just like caffe when doing a mean subtraction | |
# Seyyed Hossein Hasan Pour | |
# [email protected] | |
# 7/3/2016 | |
# Added Recall/Precision/F1-Score as well | |
# 01/03/2017 | |
# added classification using caffe.classifier, which lets you do oversampling (allows for multiple preprocessing options and crops) + the manual center crop | |
# method. its sloppy at the moment. for some reason, caffe.classifier's predict method, provides less accuracy compared to the caffes test accuracy | |
# the manuall center crop (i.e. the one which uses Caffe.Net, works just well and achieves the same accuracy as Caffe's) |
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
#in the name of God the most compassionate the most merciful | |
# added mean subtraction so that, the accuracy can be reported accurately just like caffe when doing a mean subtraction | |
# Seyyed Hossein Hasan Pour | |
# [email protected] | |
# 7/3/2016 | |
# Added Recall/Precision/F1-Score as well | |
# 01/03/2017 | |
# Added batch processing, not what used to take a minute or so, takes only several seconds! | |
# 07/25/2017 | |
#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
# Seyyed Hossein Hasan Pour | |
# [email protected] | |
# 7/3/2016 | |
# Added Recall/Precision/F1-Score as well | |
# 01/03/2017 | |
#info: | |
#if on windows, one can use these command in a batch file and ease him/her self | |
#REM Calculating Confusing Matrix | |
#python confusionMatrix_convnet_test.py --proto cifar10_deploy.prototxt --model cifar10_.caffemodel --mean mean.binaryproto --lmdb cifar10_test_lmdb | |
#pause |
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
#In the name of God | |
#Use this script to convert a binaryproto mean file to an equivalent python npy mean file. | |
#simply use the script like this : | |
#python convert_protomean.py mean.binaryproto mean.npy" | |
import caffe | |
import numpy as np | |
import sys | |
if len(sys.argv) != 3: | |
print "Usage: python convert_protomean.py mean.binaryproto mean.npy" |
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
name: "wrn_128_v8" | |
layer { | |
name: "Data1" | |
type: "Data" | |
top: "Data1" | |
top: "Data2" | |
include { | |
phase: TRAIN | |
} | |
transform_param { |
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
name: "wrn_151_v7" | |
layer { | |
name: "Data1" | |
type: "Data" | |
top: "Data1" | |
top: "Data2" | |
include { | |
phase: TRAIN | |
} | |
transform_param { |
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
#in the name of Allah, the most compassionate the most merciful | |
#run this scrip under python2. python3 would work, but not prefectly. e.g. running this script and setting oversample to true in | |
#net.predict([input_image], oversample=True) will cause a crash. but it works just fine under python2. | |
import numpy as np | |
import os, sys, getopt | |
# Main path to your caffe installation | |
caffe_root = '/path/to/your/caffe/' | |
# Model prototxt file |
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
# In the name of GOD the most compassionate the most merciful | |
# Last Updated : 4/9/2017 , updated the regex for the latest caffe (rc5) logs | |
# Originally developed by Yasse Souri | |
# Just added the search for current directory so that users dont have to use command prompts anymore! | |
# and also shows the top 4 accuracies achieved so far, and displaying the highest in the plot title | |
# Coded By: Seyyed Hossein Hasan Pour ([email protected]) | |
# -------How to Use --------------- | |
# 1.Just place your caffe's traning/test log file (with .log extension) next to this script | |
# and then run the script.If you have multiple logs placed next to the script, it will plot all of them | |
# you may also copy this script to your working directory, where you generate/keep your train/test logs |
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
# Typical setup to include TensorFlow. | |
import tensorflow as tf | |
# Make a queue of file names including all the JPEG images files in the relative | |
# image directory. | |
filename_queue = tf.train.string_input_producer( | |
tf.train.match_filenames_once("./images/*.jpg")) | |
# Read an entire image file which is required since they're JPEGs, if the images | |
# are too large they could be split in advance to smaller files or use the Fixed |