<commit_before>//
//  Detector.m
//  DetectMe
//
//  Created by <NAME> on 28/02/13.
//  Copyright (c) 2013 <NAME>. All rights reserved.
//

#include <opencv2/core/core.hpp>

#include <opencv2/ml/ml.hpp>
#include <stdlib.h>

#import "DetectorWrapper.h"
#import "UIImage+HOG.h"
#import "UIImage+Resize.h"
#import "ConvolutionHelper.h"
#import "BoundingBox.h"
#import "NSArray+JSONHelper.h"


using namespace cv;

// training parameters
#define MAX_QUOTA 200 //max negative examples (bb) per iteration
#define MAX_TEMPLATE_SIZE 8
#define STOP_CRITERIA 0.01
#define MAX_TRAINING_ITERATIONS 20
#define NUM_TRAINING_PYRAMIDS 10
#define SVM_C 0.2
#define POSITIVE_OVERLAP_AREA 0.7
#define NEGATIVE_OVERLAP_AREA 0.5
#define TRAINING_SCALE_FACTOR 0.6 //scale factor for detection on training images

// alloc size
#define MAX_TRAINING_IMAGES 35
#define MAX_NUMBER_EXAMPLES (MAX_QUOTA + 200)*MAX_TRAINING_IMAGES //max number of examples in buffer, (500neg + 200pos)*20images

//training results
#define SUCCESS 1
#define INTERRUPTED 2 //and not trained
#define FAIL 0


@interface DetectorWrapper ()
{
    int *_sizesP; //Array with the dimensions of the features: hog_width x hog_height x features_per_hog_bin
    double *_weightsP; //Array with the weights obtained in each dimension<commit_msg>Minor Changes<commit_after>//
//  Detector.m
//  DetectMe
//
//  Created by <NAME> on 28/02/13.
//  Copyright (c) 2013 <NAME>. All rights reserved.
//

#include <opencv2/core/core.hpp>

#include <opencv2/ml/ml.hpp>
#include <stdlib.h>

#import "DetectorWrapper.h"
#import "UIImage+HOG.h"
#import "UIImage+Resize.h"
#import "ConvolutionHelper.h"
#import "BoundingBox.h"
#import "NSArray+JSONHelper.h"


using namespace cv;

// training parameters
#define MAX_QUOTA 200 //max negative examples (bb) per iteration
#define MAX_TEMPLATE_SIZE 8
#define STOP_CRITERIA 0.01
#define MAX_TRAINING_ITERATIONS 20
#define NUM_TRAINING_PYRAMIDS 10
#define SVM_C 0.2
#define POSITIVE_OVERLAP_AREA 0.7
#define NEGATIVE_OVERLAP_AREA 0.5
#define TRAINING_SCALE_FACTOR 0.5 //scale factor for detection on training images

// alloc size
#define MAX_TRAINING_IMAGES 35
#define MAX_NUMBER_EXAMPLES (MAX_QUOTA + 200)*MAX_TRAINING_IMAGES //max number of examples in buffer, (500neg + 200pos)*20images

//training results
#define SUCCESS 1
#define INTERRUPTED 2 //and not trained
#define FAIL 0


@interface DetectorWrapper ()
{
    int *_sizesP; //Array with the dimensions of the features: hog_width x hog_height x features_per_hog_bin
    double *_weightsP; //Array with the weights obtained in each dimension
{'fraction_non_alphanumeric': 0.10101010101010101, 'fraction_numerical': 0.03651903651903652, 'mean_word_length': 4.722222222222222, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2178468', 'n_tokens_mistral': 1011, 'n_tokens_neox': 900, 'n_words': 270}