Skip to content

Commit

Permalink
Update with test image loading code
Browse files Browse the repository at this point in the history
  • Loading branch information
rudolphpienaar committed Apr 19, 2024
1 parent dd0ecda commit 81e5e4a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions spleenseg/spleenseg.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@
default="labelsTr",
help="name of directory containing training labels",
)
parser.add_argument(
"--testImageDir",
type=str,
default="imagesTs",
help="name of directory containing test data",
)
parser.add_argument(
"--device",
type=str,
Expand Down Expand Up @@ -114,6 +120,18 @@ def trainingData_prep(options: Namespace) -> list[dict[str, str]]:
]


def testingData_prep(options: Namespace) -> list[dict[str, str]]:
"""
Generates a list of dictionary entries, each of which is simply the name
of a test image file with its location
"""
testRaw: list[Path] = []
for path in Path(options.inputdir).rglob(options.testImageDir):
testRaw.extend(path.glob(options.pattern))
testRaw.sort()
return [{"image": str(image_name)} for image_name in testRaw]


def inputFilesSets_trainValidateFind(
options: Namespace,
) -> tuple[list[dict[str, str]], list[dict[str, str]]]:
Expand Down Expand Up @@ -186,6 +204,7 @@ def main(options: Namespace, inputdir: Path, outputdir: Path):
)

neuralNet.bestModel_runOverValidationSpace()
neuralNet.bestModel_evaluateImageSpacings(validationTransforms)

#
# trainingCache: LoaderCache
Expand Down

0 comments on commit 81e5e4a

Please sign in to comment.