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
| /*M/////////////////////////////////////////////////////////////////////////////////////// | |
| // | |
| // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. | |
| // | |
| // By downloading, copying, installing or using the software you agree to this license. | |
| // If you do not agree to this license, do not download, install, | |
| // copy or use the software. | |
| // | |
| ///*M/////////////////////////////////////////////////////////////////////////////////////// | |
| // |
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 cv2 | |
| import numpy as np | |
| import tensorflow as tf | |
| import tensorflow.examples.tutorials.mnist.input_data as input_data | |
| def init_weights(shape): | |
| return tf.Variable(tf.random_normal(shape, stddev=0.01)) | |
| def model(X, w_h, w_o): |
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
| ''' | |
| A Reccurent Neural Network (LSTM) implementation example using TensorFlow library. | |
| This example is using the MNIST database of handwritten digits (http://yann.lecun.com/exdb/mnist/) | |
| Long Short Term Memory paper: http://deeplearning.cs.cmu.edu/pdfs/Hochreiter97_lstm.pdf | |
| Author: Aymeric Damien | |
| Project: https://github.com/aymericdamien/TensorFlow-Examples/ | |
| ''' | |
| import cv2 | |
| import tensorflow as tf | |
| import tensorflow.examples.tutorials.mnist.input_data as input_data |
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
| # Copyright 2015 Google Inc. All Rights Reserved. | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, |
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 cv2 | |
| import numpy as np | |
| import tensorflow as tf | |
| def asRow(X): | |
| """ | |
| Creates a row-matrix from multi-dimensional data items in list l. | |
| X [list] List with multi-dimensional data. |
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
| #include "opencv2/opencv.hpp" | |
| using namespace cv; | |
| #include <iostream> | |
| using namespace std; | |
| // | |
| // b g r y cr cb h s v like pearls ona string. | |
| // | |
| Mat feature(const Vec3b &pixel) { |
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
| #include "opencv2/opencv.hpp" | |
| #include <iostream> | |
| using namespace cv; | |
| using namespace std; | |
| Mat im_hsv; | |
| void pick_color(int e, int x, int y, int s, void *) | |
| { | |
| if (e==1) | |
| { |
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
| // http://answers.opencv.org/moderation-queue/ | |
| var inp = document.getElementsByTagName("input") | |
| for (i=0; i<inp.length; i++) { | |
| if (inp[i].type == "checkbox") { | |
| inp[i].checked = true; | |
| } | |
| } |
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
| namespace ROC { | |
| void curve(const Mat &probs, const Mat &truth, vector<Point2f> &roc, int N, const float eps=1e-1) { | |
| for (int i=0; i<N; i++) { | |
| float thresh = float(N-i) / N; | |
| float TP = countNonZero((probs > thresh) & (truth > eps)); | |
| float TN = countNonZero((probs <= thresh) & (truth <= eps)); | |
| float FP = countNonZero((probs > thresh) & (truth <= eps)); | |
| float FN = countNonZero((probs <= thresh) & (truth > eps)); | |
| float FPR = FP / (FP + TN); | |
| float TPR = TP / (TP + FN); |
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
| #include <opencv2/opencv.hpp> | |
| #include <iostream> | |
| #include <deque> | |
| #include <map> | |
| using namespace cv; | |
| using namespace std; | |
| int main(int argc, char **argv) | |
| { |