Skip to content

Commit 84eacb3

Browse files
author
Persie
committed
fix
1 parent e30d0f4 commit 84eacb3

File tree

1 file changed

+8
-8
lines changed
  • android/src/main/java/com/vladih/computer_vision/flutter_vision/models

1 file changed

+8
-8
lines changed

android/src/main/java/com/vladih/computer_vision/flutter_vision/models/Yolo.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,10 @@ protected List < float[] > filter_box(float[][][] model_outputs, float iou_thres
208208
int max_index;
209209
float max;
210210
for (int i = 0; i < rows; i++) {
211-
x1 = (model_outputs[0][i][0] - model_outputs[0][i][2] / 2 f) * input_width;
212-
y1 = (model_outputs[0][i][1] - model_outputs[0][i][3] / 2 f) * input_height;
213-
x2 = (model_outputs[0][i][0] + model_outputs[0][i][2] / 2 f) * input_width;
214-
y2 = (model_outputs[0][i][1] + model_outputs[0][i][3] / 2 f) * input_height;
211+
x1 = (model_outputs[0][i][0] - model_outputs[0][i][2] / 2f) * input_width;
212+
y1 = (model_outputs[0][i][1] - model_outputs[0][i][3] / 2f) * input_height;
213+
x2 = (model_outputs[0][i][0] + model_outputs[0][i][2] / 2f) * input_width;
214+
y2 = (model_outputs[0][i][1] + model_outputs[0][i][3] / 2f) * input_height;
215215
conf = model_outputs[0][i][conf_index];
216216
if (conf < conf_threshold) continue;
217217
max_index = class_index;
@@ -230,12 +230,12 @@ protected List < float[] > filter_box(float[][][] model_outputs, float iou_thres
230230
tmp[2] = x2;
231231
tmp[3] = y2;
232232
tmp[4] = model_outputs[0][i][max_index];
233-
tmp[5] = (max_index - class_index) * 1 f;
233+
tmp[5] = (max_index - class_index) * 1f;
234234
pre_box.add(tmp);
235235
}
236236
}
237237
if (pre_box.isEmpty()) return new ArrayList < > ();
238-
Comparator < float[] > compareValues = (v1, v2) - > Float.compare(v2[4], v1[4]);
238+
Comparator <float[]> compareValues = (v1, v2) -> Float.compare(v2[4], v1[4]);
239239
Collections.sort(pre_box, compareValues);
240240
return nms(pre_box, iou_threshold);
241241
} catch (Exception e) {
@@ -293,8 +293,8 @@ protected List < float[] > restore_size(List < float[] > nms,
293293
nms.get(i)[3] = min(src_height, Math.max(nms.get(i)[3] * gainy, 0));
294294
}
295295
} else {
296-
float padx = (src_width - input_width) / 2 f;
297-
float pady = (src_height - input_height) / 2 f;
296+
float padx = (src_width - input_width) / 2f;
297+
float pady = (src_height - input_height) / 2f;
298298
for (int i = 0; i < nms.size(); i++) {
299299
nms.get(i)[0] = min(src_width, Math.max(nms.get(i)[0] + padx, 0));
300300
nms.get(i)[1] = min(src_height, Math.max(nms.get(i)[1] + pady, 0));

0 commit comments

Comments
 (0)