Skip to content

Instantly share code, notes, and snippets.

View Coderx7's full-sized avatar
💭
In God we Trust!

Seyyed Hossein Hasanpour Coderx7

💭
In God we Trust!
  • IRAN
  • 16:03 (UTC +03:30)
View GitHub Profile
@Coderx7
Coderx7 / confusionMatrix_Precison_Recall_F1Score_BatchMode.py
Last active September 22, 2017 20:32
its like the previous script for calculating ConfusionMatrix,Precision,Recall and stuff like before but with more preprocessing,(cropping,mean subtraction, etc)
#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
# Coderx7@Gmail.com
# 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)
@Coderx7
Coderx7 / confusionMatrix_convnet_test_BatchMode(VeryFast).py
Last active September 3, 2019 08:22
Caffe confusion matrix, precision and recall and F1 Score script!
#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
# Coderx7@Gmail.com
# 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:
@Coderx7
Coderx7 / confusionMatrix_precision_recall_F1Score_caffe2.py
Last active July 23, 2017 08:27
confusionMatrix precision recall F1Score now with caffe classifier which allows for more preprocessing options!
# Seyyed Hossein Hasan Pour
# Coderx7@Gmail.com
# 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
@Coderx7
Coderx7 / binaryprotoTonpy.py
Last active January 1, 2020 09:28
A script for converting Caffe's binaryproto mean file to npy format
#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"
@Coderx7
Coderx7 / wrn_128_v8.prototxt
Created April 24, 2017 08:04
wideresidual network in caffe_wrn_128_v8
name: "wrn_128_v8"
layer {
name: "Data1"
type: "Data"
top: "Data1"
top: "Data2"
include {
phase: TRAIN
}
transform_param {
@Coderx7
Coderx7 / wrn_151_v7.prototxt
Created April 24, 2017 08:03
wideresidual network in caffe wrn_151_v7
name: "wrn_151_v7"
layer {
name: "Data1"
type: "Data"
top: "Data1"
top: "Data2"
include {
phase: TRAIN
}
transform_param {
@Coderx7
Coderx7 / caffe_feature_extractor.py
Last active July 22, 2017 17:47 — forked from marekrei/caffe_feature_extractor.py
Caffe feature extractor
#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
@Coderx7
Coderx7 / plot_train_test_caffe_rc5.py
Created April 9, 2017 11:20
script for plotting training and testing accuracy/loss together for the latest version of caffe (rc5)
# 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 (Coderx7@gmail.com)
# -------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
@Coderx7
Coderx7 / load_jpeg_with_tensorflow.py
Created April 8, 2017 06:20 — forked from eerwitt/load_jpeg_with_tensorflow.py
Example loading multiple JPEG files with TensorFlow and make them available as Tensors with the shape [[R, G, B], ... ].
# 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
@Coderx7
Coderx7 / plot_train_test.py
Last active March 12, 2017 13:51
a script to plot train and test curves altogether.
# In the name of GOD the most compassionate the most merciful
# 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
# Added train/test plot!
# Coded By: Seyyed Hossein Hasan Pour (Coderx7@gmail.com)
# -------How to Use ---------------
# 0.First of all make sure your test layers name is 'accuracy' and the layer which reports your training accuracy is
# 'accuracy_training'. then you are good to go. if you are using different names for your test/train layers, make sure to edit
# the regex yourself. I might remove this limitation later, but at the moment this is a hacky edition to get my job done!