Don't resize when image is already scaled to network size

This commit is contained in:
Brandon Haynes 2018-08-13 09:49:18 -07:00
parent 9a4b19c415
commit e3904aebfd
1 changed files with 4 additions and 2 deletions

View File

@ -578,10 +578,12 @@ void free_detections(detection *dets, int n)
float *network_predict_image(network *net, image im)
{
image imr = letterbox_image(im, net->w, net->h);
bool resize = im.w != net->w || im.h != net->h;
image imr = resize ? letterbox_image(im, net->w, net->h) : im;
set_batch_network(net, 1);
float *p = network_predict(net, imr.data);
free_image(imr);
if(resize)
free_image(imr);
return p;
}