Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Hertz-Lab
Research
Intelligent Museum
language-identification
Commits
d5d71668
Commit
d5d71668
authored
Jul 16, 2021
by
Paul Bethge
Browse files
fix count bug
parent
6f1c1db3
Changes
1
Show whitespace changes
Inline
Side-by-side
data/other/create_small_set.py
View file @
d5d71668
...
...
@@ -12,7 +12,7 @@ from shutil import copyfile, move
import
argparse
def
create_small_dataset
(
path
,
new_path
,
dataset_size
,
move_it
=
True
):
def
create_small_dataset
(
path
,
new_path
,
dataset_size
,
move_it
):
parent_list
=
os
.
listdir
(
path
)
for
child
in
parent_list
:
...
...
@@ -31,7 +31,7 @@ def create_small_dataset(path, new_path, dataset_size, move_it=True):
subdir_list
=
os
.
listdir
(
subdir_path
)
count
=
0
for
file
in
subdir_list
:
if
dataset_size
!
=
-
1
or
count
<
dataset_size
:
if
dataset_size
=
=
-
1
or
count
<
dataset_size
:
file_path
=
os
.
path
.
join
(
subdir_path
,
file
)
new_file_path
=
os
.
path
.
join
(
new_subdir_path
,
file
)
if
move_it
:
...
...
@@ -53,6 +53,6 @@ if __name__ == "__main__":
parser
.
add_argument
(
'--source'
,
required
=
True
,
help
=
"input directory"
)
parser
.
add_argument
(
'--target'
,
required
=
True
,
help
=
"output directory"
)
parser
.
add_argument
(
'--size'
,
type
=
int
,
default
=
10
,
help
=
"put -1 for all"
)
parser
.
add_argument
(
'--move'
,
type
=
bool
,
default
=
Tru
e
,
help
=
"whether to move or just copy"
)
parser
.
add_argument
(
'--move'
,
type
=
bool
,
default
=
Fals
e
,
help
=
"whether to move or just copy"
)
cli_args
=
parser
.
parse_args
()
create_small_dataset
(
cli_args
.
source
,
cli_args
.
target
,
cli_args
.
size
,
cli_args
.
move
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment