Skip to content

Commit

Permalink
Read the imgsz parameter in metadata (#8)
Browse files Browse the repository at this point in the history
Co-authored-by: Glenn Jocher <[email protected]>
  • Loading branch information
x2031 and glenn-jocher authored Apr 10, 2024
1 parent a397568 commit f4003f7
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public abstract class Predictor {
public static final int INPUT_SIZE = 320;
public static int INPUT_SIZE = 320;
protected final Context context;
public final ArrayList<String> labels = new ArrayList<>();

Expand Down Expand Up @@ -49,6 +50,13 @@ protected void loadLabels(AssetManager assetManager, String metadataPath) throws
Map<String, Object> data = yaml.load(inputStream);
Map<Integer, String> names = ((Map<Integer, String>) data.get("names"));

List<Integer> imgszArray = (List<Integer>) data.get("imgsz");
if(imgszArray!=null&&imgszArray.size()==2){

INPUT_SIZE = imgszArray.get(0)>=imgszArray.get(1)?imgszArray.get(0):imgszArray.get(1);
System.out.println("INPUT_SIZE:"+ INPUT_SIZE);
}

labels.clear();
labels.addAll(names.values());

Expand Down

0 comments on commit f4003f7

Please sign in to comment.