Skip to content

Commit

Permalink
Letter box is disabled in the darknet.py by defualt
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexeyAB committed Jun 4, 2018
1 parent 3eb58c5 commit 1e512b2
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build/darknet/x64/darknet.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def detect(net, meta, image, thresh=.5, hier_thresh=.5, nms=.45, debug= False):
if debug: print("Assigned pnum")
predict_image(net, im)
if debug: print("did prediction")
dets = get_network_boxes(net, im.w, im.h, thresh, hier_thresh, None, 0, pnum, 1)
dets = get_network_boxes(net, im.w, im.h, thresh, hier_thresh, None, 0, pnum, 0)
if debug: print("Got dets")
num = pnum[0]
if debug: print("got zeroth index of pnum")
Expand Down
2 changes: 1 addition & 1 deletion darknet.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def detect(net, meta, image, thresh=.5, hier_thresh=.5, nms=.45, debug= False):
if debug: print("Assigned pnum")
predict_image(net, im)
if debug: print("did prediction")
dets = get_network_boxes(net, im.w, im.h, thresh, hier_thresh, None, 0, pnum, 1)
dets = get_network_boxes(net, im.w, im.h, thresh, hier_thresh, None, 0, pnum, 0)
if debug: print("Got dets")
num = pnum[0]
if debug: print("got zeroth index of pnum")
Expand Down
2 changes: 1 addition & 1 deletion src/image.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ image crop_image(image im, int dx, int dy, int w, int h);
image random_crop_image(image im, int w, int h);
image random_augment_image(image im, float angle, float aspect, int low, int high, int size);
void random_distort_image(image im, float hue, float saturation, float exposure);
image resize_image(image im, int w, int h);
YOLODLL_API image resize_image(image im, int w, int h);
void fill_image(image m, float s);
void letterbox_image_into(image im, int w, int h, image boxed);
YOLODLL_API image letterbox_image(image im, int w, int h);
Expand Down
3 changes: 2 additions & 1 deletion src/network.c
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,8 @@ void free_detections(detection *dets, int n)

float *network_predict_image(network *net, image im)
{
image imr = letterbox_image(im, net->w, net->h);
//image imr = letterbox_image(im, net->w, net->h);
image imr = resize_image(im, net->w, net->h);
set_batch_network(net, 1);
float *p = network_predict(*net, imr.data);
free_image(imr);
Expand Down

3 comments on commit 1e512b2

@vinjn
Copy link

@vinjn vinjn commented on 1e512b2 Jun 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the problem solved by this CL? letterbox_image is harmful?

@AlexeyAB
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vinjn There are pros and cons in each case: #232 (comment)

It is disabled for consistency, because in the training it is disaled too.

@vinjn
Copy link

@vinjn vinjn commented on 1e512b2 Jun 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK thx

Please sign in to comment.