Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
Beit Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
fskeese
Beit Project
Commits
82b49be5
Commit
82b49be5
authored
3 years ago
by
fskeese
Browse files
Options
Downloads
Patches
Plain Diff
Added Extracting open images
parent
0bdd7e0b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
open-images/open-images.py
+51
-0
51 additions, 0 deletions
open-images/open-images.py
with
51 additions
and
0 deletions
open-images/open-images.py
0 → 100644
+
51
−
0
View file @
82b49be5
import
argparse
import
pandas
as
pd
import
numpy
as
np
import
os
import
shutil
from
tqdm
import
tqdm
import
sys
import
tarfile
##
parser
=
argparse
.
ArgumentParser
(
description
=
"
Arguments for Prep
"
)
parser
.
add_argument
(
'
-d
'
,
'
--data
'
,
type
=
str
,
help
=
"
Pfad für den Daten Ordner
"
,
default
=
"
/nue/net_scratch/transfer/open-images-dataset
"
)
parser
.
print_help
()
args
=
parser
.
parse_args
()
##
parent_dir
=
args
.
data
assert
not
os
.
path
.
isdir
(
'
train
'
),
"
Train Ordner schon erstellt. Wurde alles entpackt? Falls nicht, lösche train Ordner und führe Programm erneut aus.
"
print
(
os
.
path
.
isdir
(
'
train
'
)
*-
1
)
os
.
makedirs
(
"
train-temp
"
)
os
.
makedirs
(
"
train
"
)
print
(
"
Extracting folders..
"
)
for
file
in
tqdm
(
os
.
listdir
(
parent_dir
)):
if
'
train_
'
in
file
:
temp
=
tarfile
.
open
(
parent_dir
+
file
,
"
r
"
)
temp
.
extractall
(
"
train-temp
"
)
temp_dir
=
"
train-temp
"
abs_path
=
os
.
path
.
abspath
(
"
train
"
)
print
(
f
'
Moving Images into
{
abs_path
}
'
)
for
f
in
tqdm
(
os
.
listdir
(
temp_dir
)):
t_dir
=
temp_dir
+
"
/
"
+
f
for
img
in
os
.
listdir
(
t_dir
):
shutil
.
move
(
t_dir
+
"
/
"
+
img
,
"
train
"
)
shutil
.
rmtree
(
"
train-temp
"
)
print
(
f
'
Nutze diesen Pfad für das Pretraining:
{
abs_path
}
'
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment