Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
Data Curator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jenny,Shane
Data Curator
Commits
fb2dc266
Commit
fb2dc266
authored
Jan 05, 2020
by
Jenny,Shane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added function to set new location for saving label data files
parent
8f82b65d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
1 deletion
+17
-1
Labelset.py
Labelset.py
+17
-1
No files found.
Labelset.py
View file @
fb2dc266
...
...
@@ -10,6 +10,7 @@ class LabelSet(object):
self
.
label_data
=
[]
for
f
in
filenames
:
self
.
label_data
.
append
({})
self
.
saveLoc
=
None
def
addFrameLabel
(
self
,
label
):
...
...
@@ -81,6 +82,16 @@ class LabelSet(object):
else
:
return
[],
[]
def
setSaveDir
(
self
,
directory
=
None
):
if
directory
!=
None
:
if
not
os
.
path
.
isdir
(
directory
):
print
(
"that directory does not exist"
)
return
else
:
if
directory
[
-
1
]
!=
'/'
:
directory
=
directory
+
"/"
self
.
saveLoc
=
directory
def
saveLabels
(
self
,
indices
=
None
):
for
fileno
,
f
in
enumerate
(
self
.
filenames
):
if
indices
==
None
or
fileno
in
indices
:
...
...
@@ -89,6 +100,12 @@ class LabelSet(object):
prefix
=
f
[
0
:
idx
]
else
:
prefix
=
f
if
self
.
saveLoc
!=
None
:
idx
=
prefix
.
rfind
(
'/'
)
if
idx
==-
1
:
prefix
=
self
.
saveLoc
+
prefix
else
:
prefix
=
self
.
saveLoc
+
prefix
[
idx
+
1
:]
labelfile
=
prefix
+
".labels"
file_labels
=
{}
...
...
@@ -108,7 +125,6 @@ class LabelSet(object):
json
.
dump
(
file_labels
,
f_obj
)
f_obj
.
close
()
if
__name__
==
'__main__'
:
testfiles
=
[
"vid01"
,
"vid03"
,
"vid04"
,
"vid05"
,
"vid06"
,
"vid07"
,
"vid08"
,
"vid09"
]
frame_labels
=
[
"a"
,
"b"
,
"c"
]
...
...
Write
Preview
Markdown
is supported
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