Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
28098b66
Commit
28098b66
authored
Jan 28, 2013
by
marina.kolpakova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor python
parent
8cf30c72
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
19 deletions
+22
-19
roc_caltech.py
apps/sft/misc/roc_caltech.py
+1
-17
sft.py
apps/sft/misc/sft.py
+21
-2
No files found.
apps/sft/misc/roc_caltech.py
View file @
28098b66
...
...
@@ -11,23 +11,7 @@ if __name__ == "__main__":
path
=
"/home/kellan/datasets/caltech/set00/V000.txt"
# open annotation file
f
=
open
(
path
)
(
nFrame
,
nSample
)
=
sft
.
caltech
.
parse_header
(
f
)
objects
=
sft
.
caltech
.
extract_objects
(
f
)
caltechSamples
=
[]
annotations
=
[[]
for
i
in
range
(
nFrame
)]
for
obj
in
objects
:
(
type
,
start
,
end
)
=
re
.
search
(
r'^lbl=\'(\w+)\'\s+str=(\d+)\s+end=(\d+)\s+hide=0$'
,
obj
[
0
])
.
groups
()
print
type
,
start
,
end
start
=
int
(
start
)
-
1
end
=
int
(
end
)
pos
=
sft
.
caltech
.
parse_pos
(
obj
[
1
])
posv
=
sft
.
caltech
.
parse_pos
(
obj
[
2
])
occl
=
sft
.
caltech
.
parse_occl
(
obj
[
3
])
for
idx
,
(
p
,
pv
,
oc
)
in
enumerate
(
zip
(
*
[
pos
,
posv
,
occl
])):
annotations
[
start
+
idx
]
.
append
((
type
,
p
,
oc
,
pv
))
annotations
=
sft
.
parse_caltech
(
f
)
for
each
in
annotations
:
print
each
apps/sft/misc/sft.py
View file @
28098b66
...
...
@@ -259,4 +259,23 @@ class caltech:
def
parse_occl
(
l
):
occl
=
re
.
match
(
r'^occl\s*=(\[[\d\s\.\;]+\])$'
,
l
)
.
group
(
1
)
occl
=
re
.
sub
(
r"\s(?!\])"
,
","
,
occl
)
return
eval
(
occl
)
\ No newline at end of file
return
eval
(
occl
)
def
parse_caltech
(
f
):
(
nFrame
,
nSample
)
=
caltech
.
parse_header
(
f
)
objects
=
caltech
.
extract_objects
(
f
)
annotations
=
[[]
for
i
in
range
(
nFrame
)]
for
obj
in
objects
:
(
type
,
start
,
end
)
=
re
.
search
(
r'^lbl=\'(\w+)\'\s+str=(\d+)\s+end=(\d+)\s+hide=0$'
,
obj
[
0
])
.
groups
()
print
type
,
start
,
end
start
=
int
(
start
)
-
1
end
=
int
(
end
)
pos
=
caltech
.
parse_pos
(
obj
[
1
])
posv
=
caltech
.
parse_pos
(
obj
[
2
])
occl
=
caltech
.
parse_occl
(
obj
[
3
])
for
idx
,
(
p
,
pv
,
oc
)
in
enumerate
(
zip
(
*
[
pos
,
posv
,
occl
])):
annotations
[
start
+
idx
]
.
append
((
type
,
p
,
oc
,
pv
))
return
annotations
\ No newline at end of file
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