Permalink
Browse files

renaming

  • Loading branch information...
jonhare committed Oct 9, 2017
1 parent df73d85 commit 8d15a1b227d36058e1cb1b218b660e7afc3aa77f
@@ -14,19 +14,19 @@
* confidence that a given patch is positive. This is calculated using the
* correlation between the new patch and the false positive and falst negatives
* such that:
*
*
* confidence = dP / (dN + dP)
*
*
* and dP = max(corr(patch,truePositives)) dP = max(corr(patch,falsePositives))
*
*
* if no true positives have been seen, classify will always return 0 if not
* false positives have been seen, classify will always return 1
*
*
* classify is used by filter such that if the confidence of a patch is larger
* than {@link #thetaTP} the patch is though to be a good patch for the object.
*
*
* @author Sina Samangooei (ss@ecs.soton.ac.uk)
*
*
*/
public class NNClassifier {
/**
@@ -70,7 +70,7 @@ public void release() {
}
/**
*
*
* @param f1
* @param f2
* @return correlation between two patches (assumed to be the same size)
@@ -83,7 +83,7 @@ private float ncc(FImage f1, FImage f2) {
}
/**
*
*
* @param patch
* @return The confidence that a given patch is a postive
*/
@@ -144,7 +144,7 @@ float classifyWindow(FImage img, int windowIdx) {
patch.source = img;
// here we reuse the scales images as the patch of the right
// width/height and just write into it.
patch.normalisedPatch = patch.zoomAndNormaliseTo(NormalizedPatch.SLUT_WORKSPACE);
patch.normalisedPatch = patch.zoomAndNormaliseTo(NormalizedPatch.WORKSPACE);
return classifyPatch(patch);
}
@@ -174,7 +174,7 @@ public boolean filter(FImage img, int windowIdx) {
* to the true positives If the patch is said to be negative and has a
* confidence higher than {@link #thetaFP} add the patch to the false
* positives
*
*
* @param patches
*/
public void learn(List<NormalizedPatch> patches) {
@@ -186,7 +186,7 @@ public void learn(List<NormalizedPatch> patches) {
// etc yet!
// it uses the prepared windows, so a held scale patch can be used
if (!patch.positive) {
patch.normalisedPatch = patch.zoomAndNormaliseTo(NormalizedPatch.SLUT_WORKSPACE);
patch.normalisedPatch = patch.zoomAndNormaliseTo(NormalizedPatch.WORKSPACE);
}
final float conf = classifyPatch(patch);
@@ -196,9 +196,10 @@ public void learn(List<NormalizedPatch> patches) {
}
if (!patch.positive && conf >= thetaFP) {
// We must handle the SLUT_WORKSPACE!
// If we're negative we are using the slut, if we're planning to
// keep this negative we must NOW clone the slut
// We must handle the WORKSPACE!
// If we're negative we are using the workspace, if we're
// planning to keep this negative we must NOW clone the
// workspace
patch.normalisedPatch = patch.normalisedPatch.clone();
falsePositives.add(patch);
}
@@ -10,9 +10,9 @@
/**
* Defines a intensity normalised patch extracted from an image. Allowances are
* made for reuse of patches
*
*
* @author Sina Samangooei (ss@ecs.soton.ac.uk)
*
*
*/
public class NormalizedPatch {
private final static MeanCenter msp = new MeanCenter();
@@ -23,10 +23,9 @@
private static final ResizeFilterFunction filter = TriangleFilter.INSTANCE;
/**
* The slut workspace gets around a little bit. Use the slut workspace but
* don't expect it to be yours for long.
* The workspace
*/
public static final FImage SLUT_WORKSPACE = new FImage(TLD_PATCH_SIZE, TLD_PATCH_SIZE);
public static final FImage WORKSPACE = new FImage(TLD_PATCH_SIZE, TLD_PATCH_SIZE);
/**
* Is this patch positive, i.e. representative of the object
*/
@@ -40,7 +39,7 @@
*/
public Rectangle window;
/**
* The extracted patch, might be null, might be the SLUT_WORKSPACE.
* The extracted patch, might be null, might be the WORKSPACE.
*/
public FImage normalisedPatch;
@@ -49,10 +48,10 @@
* {@link ResizeProcessor#zoom(FImage, Rectangle, FImage, Rectangle, ResizeFilterFunction)}
* on a to put {@link NormalizedPatch#window} form
* {@link NormalizedPatch#source} into normalisedPatch.
*
*
* This is not a convenient function but it allows for very efficient
* resize/normalisation process (with minimal new stuff constructed)
*
*
* @param holder
* @return the holder as a convenience
*/
@@ -63,7 +62,7 @@ protected FImage zoomAndNormaliseTo(FImage holder) {
/**
* calculate the variance, sets the valueImg if it is null
*
*
* @return an inefficient way to calculate variance of this window, a new
* image is constructed!
*/

0 comments on commit 8d15a1b

Please sign in to comment.