<commit_before>#include "ccv.h"

void print_help()
{
	printf("format: sgfcreate posfile posnum negfile negnum\n");
}

int main(int argc, char** argv)
{
	if (argc != 5)
	{
		print_help();
		return -1;
	}
	int i, rt;
	int posnum = atoi(argv[2]);
	FILE* pf = fopen(argv[1], "r");
	ccv_dense_matrix_t** posimg = (ccv_dense_matrix_t**)malloc(sizeof(posimg[0]) * posnum);
	for (i = 0; i < posnum; i++)
	{
		char buf[1024];
		rt = fscanf(pf, "%s", buf);
		ccv_unserialize(buf, &posimg[i], CCV_SERIAL_GRAY | CCV_SERIAL_ANY_FILE);
	}
	fclose(pf);
	int negnum = atoi(argv[4]);
	FILE* bgf = fopen(argv[3], "r");
	int bgnum;
	rt = fscanf(bgf, "%d", &bgnum);
	char** bgfiles = (char**)malloc(sizeof(bgfiles[0]) * bgnum);
	for (i = 0; i < bgnum; i++)
	{
		bgfiles[i] = (char*)malloc(1024);
		rt = fscanf(bgf, "%s", bgfiles[i]);
	}
	fclose(bgf);
	ccv_sgf_param_t params;
	params.pos_crit = 0.9975;
	params.neg_crit = 0.2;
	params.balance_k = 1.0;
	params.layer = 24;
	params.feature_number = 100;
	ccv_sgf_classifier_cascade_new(posimg, posnum, bgfiles, bgnum, negnum, ccv_size(28, 28), "data", params);
	for (i = 0; i < bgnum; i++)
		free(bgfiles[i]);
	for (i = 0; i < posnum; i++)
		ccv_matrix_free(&posimg[i]);
	free(posimg);
	free(bgfiles);<commit_msg>modified:   sgfcreate.c<commit_after>#include "ccv.h"

void print_help()
{
	printf("format: sgfcreate posfile posnum negfile negnum\n");
}

int main(int argc, char** argv)
{
	if (argc != 5)
	{
		print_help();
		return -1;
	}
	int i, rt;
	int posnum = atoi(argv[2]);
	FILE* pf = fopen(argv[1], "r");
	ccv_dense_matrix_t** posimg = (ccv_dense_matrix_t**)malloc(sizeof(posimg[0]) * posnum);
	for (i = 0; i < posnum; i++)
	{
		char buf[1024];
		rt = fscanf(pf, "%s", buf);
		ccv_unserialize(buf, &posimg[i], CCV_SERIAL_GRAY | CCV_SERIAL_ANY_FILE);
	}
	fclose(pf);
	int negnum = atoi(argv[4]);
	FILE* bgf = fopen(argv[3], "r");
	int bgnum;
	rt = fscanf(bgf, "%d", &bgnum);
	char** bgfiles = (char**)malloc(sizeof(bgfiles[0]) * bgnum);
	for (i = 0; i < bgnum; i++)
	{
		bgfiles[i] = (char*)malloc(1024);
		rt = fscanf(bgf, "%s", bgfiles[i]);
	}
	fclose(bgf);
	ccv_sgf_param_t params;
	params.pos_crit = 0.995;
	params.neg_crit = 0.5;
	params.balance_k = 1.0;
	params.layer = 24;
	params.feature_number = 100;
	ccv_sgf_classifier_cascade_new(posimg, posnum, bgfiles, bgnum, negnum, ccv_size(28, 28), "data", params);
	for (i = 0; i < bgnum; i++)
		free(bgfiles[i]);
	for (i = 0; i < posnum; i++)
		ccv_matrix_free(&posimg[i]);
	free(posimg);
	free(bgfiles);
{'fraction_non_alphanumeric': 0.1967081493376154, 'fraction_numerical': 0.030108390204737052, 'mean_word_length': 4.676537585421412, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 3, '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': '1250980', 'n_tokens_mistral': 1212, 'n_tokens_neox': 1152, 'n_words': 238}