Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Matt Harvey
five-video-classification-methods
Commits
301525df
Commit
301525df
authored
7 years ago
by
Matt Harvey
Browse files
Options
Download
Email Patches
Plain Diff
Fix more paths
parent
6eb53ffd
master
add-demo-script
github/fork/Anner-deJong/patch-2
github/fork/ideaRunner/edit_move_file
github/fork/ikvision/master
github/fork/mertia-himanshu/master
github/fork/prabindh/master
github/fork/sanshibayuan/master
playground
playground-add-synthetic
v1.0
1 merge request
!43
Create paths in an OS-agnostic way.
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
data.py
+5
-5
data.py
extract_features.py
+2
-2
extract_features.py
validate_cnn.py
+2
-1
validate_cnn.py
with
9 additions
and
8 deletions
+9
-8
data.py
+
5
-
5
View file @
301525df
...
...
@@ -22,7 +22,7 @@ class DataSet():
"""
self
.
seq_length
=
seq_length
self
.
class_limit
=
class_limit
self
.
sequence_path
=
'./data/
sequences
/
'
self
.
sequence_path
=
os
.
path
.
join
(
'data'
,
'
sequences'
)
self
.
max_frames
=
300
# max number of frames a video can have for us to use it
# Get the data.
...
...
@@ -39,7 +39,7 @@ class DataSet():
@
staticmethod
def
get_data
():
"""Load our data from file."""
with
open
(
'./data/
data_file.csv'
,
'r'
)
as
fin
:
with
open
(
os
.
path
.
join
(
'data'
,
'
data_file.csv'
)
,
'r'
)
as
fin
:
reader
=
csv
.
reader
(
fin
)
data
=
list
(
reader
)
...
...
@@ -203,14 +203,14 @@ class DataSet():
def
get_frames_for_sample
(
sample
):
"""Given a sample row from the data file, get all the corresponding frame
filenames."""
path
=
'./data/'
+
sample
[
0
]
+
'/'
+
sample
[
1
]
+
'/'
path
=
os
.
path
.
join
(
'data'
,
sample
[
0
]
,
sample
[
1
]
)
filename
=
sample
[
2
]
images
=
sorted
(
glob
.
glob
(
path
+
filename
+
'*jpg'
))
images
=
sorted
(
glob
.
glob
(
os
.
path
.
join
(
path
,
filename
+
'*jpg'
))
)
return
images
@
staticmethod
def
get_filename_from_image
(
filename
):
parts
=
filename
.
split
(
'/'
)
parts
=
filename
.
split
(
os
.
path
.
sep
)
return
parts
[
-
1
].
replace
(
'.jpg'
,
''
)
@
staticmethod
...
...
This diff is collapsed.
Click to expand it.
extract_features.py
+
2
-
2
View file @
301525df
...
...
@@ -32,8 +32,8 @@ pbar = tqdm(total=len(data.data))
for
video
in
data
.
data
:
# Get the path to the sequence for this video.
path
=
'./data/
sequences
/'
+
video
[
2
]
+
'-'
+
str
(
seq_length
)
+
\
'-features.txt'
path
=
os
.
path
.
join
(
'data'
,
'
sequences
'
,
video
[
2
]
+
'-'
+
str
(
seq_length
)
+
\
'-features.txt'
)
# Check if we already have it.
if
os
.
path
.
isfile
(
path
):
...
...
This diff is collapsed.
Click to expand it.
validate_cnn.py
+
2
-
1
View file @
301525df
...
...
@@ -5,6 +5,7 @@ import numpy as np
import
operator
import
random
import
glob
import
os.path
from
data
import
DataSet
from
processor
import
process_image
from
keras.models
import
load_model
...
...
@@ -15,7 +16,7 @@ def main(nb_images=5):
model
=
load_model
(
'data/checkpoints/inception.057-1.16.hdf5'
)
# Get all our test images.
images
=
glob
.
glob
(
'./data/test/**/
*.jpg'
)
images
=
glob
.
glob
(
os
.
path
.
join
(
'data'
,
'test'
,
'**'
,
'
*.jpg'
)
)
for
_
in
range
(
nb_images
):
print
(
'-'
*
80
)
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets