Skip to content

Commit 82abf9f

Browse files
yolo v3. adjust source code
1 parent ba6f1c6 commit 82abf9f

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

caffe_models/yolo_v3/yolov3.cc

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ Layer make_yolo_layer(Blob_and_size<data_type> &B, int mask[]) {
719719

720720
template <typename data_type>
721721
void run_tiny_yolo(
722-
Blob_and_size<data_type> *outputs, IN_SIZE, bool fixed = false) {
722+
Blob_and_size<data_type> **outputs, IN_SIZE, bool fixed = false) {
723723
typedef Blob_and_size<data_type> BS;
724724
// Create a yolo layer for the two outputs.
725725
// From examples/detector.c
@@ -741,8 +741,8 @@ void run_tiny_yolo(
741741

742742
// We happen to know that the output list from the tool is backwards; last
743743
// yolo layer appers first in the list.
744-
BS &B0 = outputs[1];
745-
BS &B1 = outputs[0];
744+
BS &B0 = *outputs[1];
745+
BS &B1 = *outputs[0];
746746
BS *ptrs[]= {&B0,&B1};
747747

748748
/*
@@ -763,9 +763,9 @@ void run_tiny_yolo(
763763

764764
#else
765765
// Entries in this array are in a weird order.
766-
BS &B0 = outputs[0]; // layer82
767-
BS &B1 = outputs[2]; // layer94
768-
BS &B2 = outputs[1]; // layer106
766+
BS &B0 = *outputs[0]; // layer82
767+
BS &B1 = *outputs[2]; // layer94
768+
BS &B2 = *outputs[1]; // layer106
769769
BS *ptrs[] = {&B0,&B1,&B2};
770770

771771
int M0[] = {6,7,8}, M1[] = {3,4,5}, M2[] = {0,1,2};
@@ -783,7 +783,7 @@ void run_tiny_yolo(
783783
// Convert double or int to float.
784784
int max = 0;
785785
for (int i = 0; i < noutputs; i++) {
786-
int s = outputs[i].num_pixels();
786+
int s = outputs[i]->num_pixels();
787787
if (s > max) max = s;
788788
}
789789
0 && printf("!malloc %d floats\n",max);
@@ -800,17 +800,17 @@ void run_tiny_yolo(
800800
}
801801

802802
extern void yolo_float(void *_outputs, IN_SIZE) {
803-
Blob_and_size<float>*outputs = (Blob_and_size<float>*)_outputs;
803+
Blob_and_size<float>**outputs = (Blob_and_size<float>**)_outputs;
804804
run_tiny_yolo<float>(outputs,noutputs,data_ch,data_y,data_x);
805805
}
806806

807807
extern void yolo_double(void*_outputs, IN_SIZE) {
808-
Blob_and_size<double>*outputs = (Blob_and_size<double>*)_outputs;
808+
Blob_and_size<double>**outputs = (Blob_and_size<double>**)_outputs;
809809
run_tiny_yolo<double>(outputs,noutputs,data_ch,data_y,data_x);
810810
}
811811

812812
extern void yolo_fixed(void *_outputs, IN_SIZE) {
813-
Blob_and_size<short> *outputs = (Blob_and_size<short> *)_outputs;
813+
Blob_and_size<short> **outputs = (Blob_and_size<short> **)_outputs;
814814
0 && printf("ch %d y %d x %d\n",data_ch,data_y,data_x);
815815
run_tiny_yolo<short>(outputs,noutputs,data_ch,data_y,data_x,true);
816816
}

0 commit comments

Comments
 (0)