X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/myo-class.git/blobdiff_plain/bdfe02afe03428e59b3c85b6cae19d579d82f55c..refs/heads/master:/tosampledir.py diff --git a/tosampledir.py b/tosampledir.py index 1846c1d..98d9aa5 100644 --- a/tosampledir.py +++ b/tosampledir.py @@ -3,9 +3,9 @@ from os.path import join, splitext from shutil import move as mv, copyfile as cp import pathlib -def move(indir, outdir, n, distinction_word='', copy=True):# move n ordered files from indir to outdir +def move(indir, outdir, start=None, end=None, distinction_word='', copy=True):# move start ordered files from indir to outdir l = sorted(ls(indir)) - for filename in l[:n]: + for filename in l[start:end]: # print(join(indir, filename), join(outdir, filename)) pathlib.Path(outdir).mkdir(parents=True, exist_ok=True) fname, fextension = splitext(filename) @@ -14,7 +14,10 @@ def move(indir, outdir, n, distinction_word='', copy=True):# move n ordered file if __name__ == '__main__': - move('./generated/90/infarctus/crop-nomask', './sample/train/infarctus', 400, distinction_word="-crop-nomask") # move 400 ordered files from param 1 to param 2 - move('./generated/90/noinfarctus/crop-nomask', './sample/train/noinfarctus', 400, distinction_word="-crop-nomask") - move('./generated/90/infarctus/crop-nomask', './sample/valid/infarctus', 100, distinction_word="-crop-nomask") - move('./generated/90/noinfarctus/crop-nomask', './sample/valid/noinfarctus', 100, distinction_word="-crop-nomask") \ No newline at end of file + move('./generated/updated/infarctus/crop-mask', './sample/train/infarctus', 0, 800, distinction_word="-crop-mask") # move [0 -> 600] ordered files from param 1 to param 2 + move('./generated/updated/infarctus/crop-mask', './sample/valid/infarctus', 800, 1100, distinction_word="-crop-mask") + move('./generated/updated/infarctus/crop-mask', './sample/test/infarctus', 1100, 1200, distinction_word="-crop-mask") + + move('./generated/updated/noinfarctus/crop-mask', './sample/train/noinfarctus', 0, 100, distinction_word="-crop-mask") + move('./generated/updated/noinfarctus/crop-mask', './sample/valid/noinfarctus', 100, 160, distinction_word="-crop-mask") + move('./generated/updated/noinfarctus/crop-mask', './sample/test/noinfarctus', 160, 200, distinction_word="-crop-mask")