Skip to content

Commit f29a6bf

Browse files
author
donglaiw
committed
allow test_single from backward
1 parent 394504f commit f29a6bf

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

connectomics/config/defaults.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@
482482
_C.INFERENCE.IS_ABSOLUTE_PATH = None
483483
_C.INFERENCE.DO_CHUNK_TITLE = None
484484

485-
# Do inference one-by-on (load a volume when needed).
485+
# Do inference one-by-one (load a volume when needed).
486486
_C.INFERENCE.DO_SINGLY = False
487487
_C.INFERENCE.DO_SINGLY_START_INDEX = 0
488488
_C.INFERENCE.DO_SINGLY_STEP = 1

connectomics/engine/trainer.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,11 @@ def test_singly(self):
310310
else:
311311
# same file location
312312
output_name = [x+'_result.h5' for x in img_name]
313-
314-
for i in range(self.cfg.INFERENCE.DO_SINGLY_START_INDEX, num_file, self.cfg.INFERENCE.DO_SINGLY_STEP):
313+
314+
ran = range(self.cfg.INFERENCE.DO_SINGLY_START_INDEX, num_file, abs(self.cfg.INFERENCE.DO_SINGLY_STEP))
315+
if self.cfg.INFERENCE.DO_SINGLY_STEP < 0:
316+
ran = ran[::-1]
317+
for i in ran:
315318
self.test_filename = output_name[i]
316319
if not os.path.exists(self.test_filename):
317320
if dir_name is not None:

0 commit comments

Comments
 (0)