Closed ZQPei closed 4 years ago
I modified it slightly so as not to mess with an array of useless files:
int main(int argc, char** argv)
{
char image_path[100];
char mask_path[100];
char masked_path[100];
char output_path[100];
double psnr_mean[3] = {0,};
double ssim_mean[3] = {0,};
double time_mean[3] = {0,};
double psnr_total = 0.0;
double ssim_total = 0.0;
double time_total = 0.0;
for(int i = 0; i < 6000; ++i)
{
for(int j = 0; j < 3; ++j)
{
sprintf(image_path, "../image_files/inpainting/image/image_%05d.png", j);
sprintf(mask_path, "../image_files/inpainting/mask/mask_%05d.png", j);
sprintf(masked_path, "../image_files/inpainting/masked_image/masked_image_%05d.png", j);
sprintf(output_path, "../image_files/inpainting/output/output_%05d.png", j);
process(image_path, mask_path, output_path, &psnr_total, &ssim_total, &time_total);
psnr_mean[j] = psnr_total/6000.0;
ssim_mean[j] = ssim_total/6000.0;
time_mean[j] = time_total/6000.0;
}
}
for(int i = 0; i < 3; ++i)
{
printf("[%02d%% - %02d%%] average psnr: %lf\taverage ssim: %lf\taverage time: %lf\n", i*10, (i+1)*10, psnr_mean[i], ssim_mean[i], time_mean[i]);
}
return 0;
}
Really, eats memory. Will seek.
I did not find the release of memory allocated for the image after it was written to the media.
PS: Fresh yes.
Maybe add?:
cvReleaseImage(& output_ipl_img);
Cool! Do the memory leaking problem solved now? I don't test, cause I dont have opencv install on my laptop now.
@ZQPei . He eats a lot. But it does not grow as before. I will wait for the tests. If all is well, do a new release (0.2). (This is important to me, I am also a maintainer).
@zvezdochiot The memory will overflow if proceeding mounts of images in one program. How to get this:
First prepare a large test set of 1000 images or more. For simpility, just copy the existing test images for 400 times, the same to the masks. Rename then as
image_00001.png
,image_00002.png
, etc.Replace the
main
function as what I did at the very beginning. It was tested on 12000 images with 6 group of masks. You may need modify the code below a little bit to run on your test images properly.If you find your memory usage growing continuously, that is the implicit problem hidden in the
process
function which will cause segmentation fault.