mirror of
https://github.com/pjreddie/darknet.git
synced 2023-08-10 21:13:14 +03:00
Update detector.c
Fix an issue with YOLO crash if number of validated examples less then 4 due to trying to access to unaddressable memory path[i+t], when i+t > nthreads.
This commit is contained in:
parent
16686cec57
commit
7ee9ebda1f
@ -290,6 +290,12 @@ void validate_detector_flip(char *datacfg, char *cfgfile, char *weightfile, char
|
|||||||
float nms = .45;
|
float nms = .45;
|
||||||
|
|
||||||
int nthreads = 4;
|
int nthreads = 4;
|
||||||
|
// fix an issue with YOLO crash if number of validated examples less then 4
|
||||||
|
// due to trying to access to unaddressable memory path[i+t], when i+t > nthreads
|
||||||
|
if (m < 4) {
|
||||||
|
nthreads = m;
|
||||||
|
}
|
||||||
|
|
||||||
image *val = calloc(nthreads, sizeof(image));
|
image *val = calloc(nthreads, sizeof(image));
|
||||||
image *val_resized = calloc(nthreads, sizeof(image));
|
image *val_resized = calloc(nthreads, sizeof(image));
|
||||||
image *buf = calloc(nthreads, sizeof(image));
|
image *buf = calloc(nthreads, sizeof(image));
|
||||||
@ -423,6 +429,12 @@ void validate_detector(char *datacfg, char *cfgfile, char *weightfile, char *out
|
|||||||
float nms = .45;
|
float nms = .45;
|
||||||
|
|
||||||
int nthreads = 4;
|
int nthreads = 4;
|
||||||
|
// fix an issue with YOLO crash if number of validated examples less then 4
|
||||||
|
// due to trying to access to unaddressable memory path[i+t], when i+t > nthreads
|
||||||
|
if (m < 4) {
|
||||||
|
nthreads = m;
|
||||||
|
}
|
||||||
|
|
||||||
image *val = calloc(nthreads, sizeof(image));
|
image *val = calloc(nthreads, sizeof(image));
|
||||||
image *val_resized = calloc(nthreads, sizeof(image));
|
image *val_resized = calloc(nthreads, sizeof(image));
|
||||||
image *buf = calloc(nthreads, sizeof(image));
|
image *buf = calloc(nthreads, sizeof(image));
|
||||||
|
Loading…
Reference in New Issue
Block a user