mirror of
https://github.com/pjreddie/darknet.git
synced 2023-08-10 21:13:14 +03:00
Flipping features now a flag
This commit is contained in:
parent
15e86996d6
commit
1b5e6d8855
@ -528,22 +528,25 @@ void features_VOC(int part, int total)
|
|||||||
|
|
||||||
void features_VOC_image(char *image_file, char *image_dir, char *out_dir)
|
void features_VOC_image(char *image_file, char *image_dir, char *out_dir)
|
||||||
{
|
{
|
||||||
|
int flip = 1;
|
||||||
|
int interval = 4;
|
||||||
int i,j;
|
int i,j;
|
||||||
network net = parse_network_cfg("cfg/voc_imagenet.cfg");
|
network net = parse_network_cfg("cfg/voc_imagenet.cfg");
|
||||||
char image_path[1024];
|
char image_path[1024];
|
||||||
sprintf(image_path, "%s%s",image_dir, image_file);
|
sprintf(image_path, "%s%s",image_dir, image_file);
|
||||||
char out_path[1024];
|
char out_path[1024];
|
||||||
sprintf(out_path, "%s%s.txt",out_dir, image_file);
|
if (flip)sprintf(out_path, "%s%d/%s_r.txt",out_dir, interval, image_file);
|
||||||
|
else sprintf(out_path, "%s%d/%s.txt",out_dir, interval, image_file);
|
||||||
printf("%s\n", image_file);
|
printf("%s\n", image_file);
|
||||||
FILE *fp = fopen(out_path, "w");
|
FILE *fp = fopen(out_path, "w");
|
||||||
if(fp == 0) file_error(out_path);
|
if(fp == 0) file_error(out_path);
|
||||||
|
|
||||||
IplImage* src = 0;
|
IplImage* src = 0;
|
||||||
if( (src = cvLoadImage(image_path,-1)) == 0 ) file_error(image_path);
|
if( (src = cvLoadImage(image_path,-1)) == 0 ) file_error(image_path);
|
||||||
|
if(flip)cvFlip(src, 0, 1);
|
||||||
int w = src->width;
|
int w = src->width;
|
||||||
int h = src->height;
|
int h = src->height;
|
||||||
int sbin = 8;
|
int sbin = 8;
|
||||||
int interval = 10;
|
|
||||||
double scale = pow(2., 1./interval);
|
double scale = pow(2., 1./interval);
|
||||||
int m = (w<h)?w:h;
|
int m = (w<h)?w:h;
|
||||||
int max_scale = 1+floor((double)log((double)m/(5.*sbin))/log(scale));
|
int max_scale = 1+floor((double)log((double)m/(5.*sbin))/log(scale));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user