Skip to content

Commit

Permalink
test even on mdoels that do not have sample tif
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosuc3m committed Nov 13, 2024
1 parent 3f3d9de commit d3135fd
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
20 changes: 20 additions & 0 deletions .github/create_macro.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,25 @@
from io.bioimage.modelrunner.bioimageio import BioimageioRepo
from io.bioimage.modelrunner.bioimageio.description import ModelDescriptorFactory
from io.bioimage.modelrunner.utils import Constants
from io.bioimage.modelrunner.numpy import DecodeNumpy

from deepimagej.tools import ImPlusRaiManager

from ij import IJ

import os
import argparse

MACRO_STR = "run(\"DeepImageJ Run\", \"modelPath={model_path} inputPath={input_path} outputFolder={output_folder} displayOutput=null\")"
CREATED_SAMPLE_NAME = "sample_input_0.tif"


def convert_npy_to_tif(folder_path, test_name, axesOrder):
rai = DecodeNumpy.loadNpy(os.path.join(folder_path, test_name))
imp = ImPlusRaiManager.convert(rai, axesOrder)
out_path = os.path.join(folder_path, CREATED_SAMPLE_NAME)
IJ.saveAsTiff(imp, out_path)


# Create the argument parser
parser = argparse.ArgumentParser()
Expand Down Expand Up @@ -73,6 +87,12 @@ def parse_model_paths(models):
print(mfp)
descriptor = ModelDescriptorFactory.readFromLocalFile(os.path.join(mfp, Constants.RDF_FNAME))
sample_name = descriptor.getInputTensors().get(0).getSampleTensorName()
if sample_name is None:
test_name = descriptor.getInputTensors().get(0).getTestTensorName()
if test_name is None:
continue
convert_npy_to_tif(mfp, test_name, descriptor.getInputTensors().get(0).getAxesOrder())
sample_name = CREATED_SAMPLE_NAME
macro = MACRO_STR.format(model_path=mfp, input_path=os.path.join(mfp, sample_name), output_folder=mfp)
file.write(macro + os.linesep)

3 changes: 1 addition & 2 deletions .github/workflows/integration_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ on:
branches: [ master ]

env:
MODELS: "ambitious-sloth, placid-llama, chatty-frog, hiding-tiger"
#MODELS: "ambitious-sloth, placid-llama, chatty-frog, hiding-tiger, laid-back-lobster"
MODELS: "ambitious-sloth, placid-llama, chatty-frog, hiding-tiger, laid-back-lobster"

jobs:
integration-tests:
Expand Down
1 change: 0 additions & 1 deletion scripts/download_engines.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import argparse
import sys

print("All arguments (including script name): {}".format(sys.argv))

# Create the argument parser
parser = argparse.ArgumentParser()
Expand Down

0 comments on commit d3135fd

Please sign in to comment.