Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read the imgsz parameter in metadata #8

Merged
merged 3 commits into from
Apr 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading