Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Unsupervised Video Summarization
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hussain Kanafani
Unsupervised Video Summarization
Commits
b9e507d2
Commit
b9e507d2
authored
4 years ago
by
Hussain Kanafani
Browse files
Options
Downloads
Patches
Plain Diff
f1-score w.r.t nframes updated
parent
93e296da
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/visualize_fscores_nframes.py
+59
-38
59 additions, 38 deletions
src/visualize_fscores_nframes.py
with
59 additions
and
38 deletions
src/visualize_fscores_nframes.py
+
59
−
38
View file @
b9e507d2
...
...
@@ -6,32 +6,26 @@ import seaborn as sns
import
matplotlib.pyplot
as
plt
import
pandas
as
pd
PROCESSED_SUMME
=
'
../data/SumMe/processed/eccv16_dataset_summe_google_pool5.h5
'
PROCESSED_TVSUM
=
'
../data/TVSUM/processed/eccv16_dataset_tvsum_google_pool5.h5
'
sns
.
set
()
sns
.
set_style
(
"
darkgrid
"
)
videos
=
{}
x_axis
=
[]
y_axis
=
[]
original_splits
=
'
../results/TVSum/video_scores/original splits/
'
non_overlapping_splits
=
'
../results/TVSum/video_scores/non overlapping splits/
'
tvsum_
original_splits
=
'
../results/TVSum/video_scores/original splits/
'
tvsum_
non_overlapping_splits
=
'
../results/TVSum/video_scores/non overlapping splits/
'
type
=
'
tvsum
'
if
type
==
'
tvsum
'
:
dataset
=
load_processed_dataset
(
processed_dataset
=
PROCESSED_TVSUM
)
n_videos
=
50
else
:
dataset
=
load_processed_dataset
(
processed_dataset
=
PROCESSED_SUMME
)
summe_original_splits
=
'
../results/SumMe/video_scores/original splits/
'
summe_non_overlapping_splits
=
'
../results/SumMe/video_scores/non overlapping/
'
n_videos
=
25
n_splits
=
5
def
read_scores
(
dir
,
n_splits
,
n_videos
):
df
=
pd
.
DataFrame
(
columns
=
[
'
nframes
'
,
'
F1-scores
'
])
def
read_scores
(
dir
,
n_splits
):
df
=
pd
.
DataFrame
(
columns
=
[
'
Number of Frames
'
,
'
F1-score
'
,
'
vid
'
])
df
.
set_index
(
'
Number of Frames
'
,
inplace
=
True
)
for
split
in
range
(
n_splits
):
path
=
dir
+
'
/video_scores{}.txt
'
.
format
(
split
)
print
(
path
)
...
...
@@ -39,42 +33,69 @@ def read_scores(dir,n_splits,n_videos):
videos
=
json
.
load
(
infile
)
print
(
videos
.
keys
())
for
key
in
videos
.
keys
():
nframes
=
dataset
[
'
video_
'
+
key
][
'
nframes
'
]
# d = {'Videos': key, 'F1-score
s
': videos[key]}
d
=
pd
.
Series
({
'
nf
rames
'
:
nframes
,
'
F1-score
s
'
:
videos
[
key
]}
)
nframes
=
dataset
[
'
video_
'
+
key
][
'
nframes
'
]
# d = {'Videos': key, 'F1-score': videos[key]}
d
=
{
'
Number of F
rames
'
:
nframes
,
'
F1-score
'
:
videos
[
key
]
,
'
vid
'
:
key
}
df
=
df
.
append
(
d
,
ignore_index
=
True
)
df
[
'
nframes
'
]
=
df
[
'
nframes
'
].
astype
(
int
)
series
=
df
.
groupby
(
'
nframes
'
)[
'
F1-scores
'
].
mean
()
df
=
df
.
sort_index
(
ascending
=
True
)
df
[
'
Number of Frames
'
]
=
df
[
'
Number of Frames
'
].
astype
(
int
)
df
=
df
.
groupby
([
'
vid
'
,
'
Number of Frames
'
])[
'
F1-score
'
].
mean
()
df
=
df
.
sort_index
(
level
=
1
)
print
(
list
(
df
.
index
.
values
))
# print(len(list(series.index.values)))
print
(
df
)
return
df
print
(
list
(
series
.
index
.
values
))
#print(len(list(series.index.values)))
series
=
series
.
sort_index
(
ascending
=
True
)
print
(
series
)
return
series
type
=
'
tvsum
'
n_splits
=
5
step
=
2500
if
type
==
'
tvsum
'
:
dataset
=
load_processed_dataset
(
processed_dataset
=
PROCESSED_TVSUM
)
original_videos
=
read_scores
(
tvsum_non_overlapping_splits
,
n_splits
)
df
=
pd
.
DataFrame
({
'
vid
'
:
original_videos
.
index
.
get_level_values
(
0
),
'
Number of Frames
'
:
original_videos
.
index
.
get_level_values
(
1
),
'
F1-score
'
:
original_videos
.
values
})
x_axis_stop
=
df
[
'
Number of Frames
'
].
max
()
+
step
x_axis_start
=
df
[
'
Number of Frames
'
].
min
()
original_videos
=
read_scores
(
original_splits
,
n_splits
,
n_videos
)
#non_overlapping_videos = read_scores(non_overlapping_splits,n_splits,n_videos)
#diff= (non_overlapping_videos.values + original_videos.values)/2
else
:
dataset
=
load_processed_dataset
(
processed_dataset
=
PROCESSED_SUMME
)
original_videos
=
read_scores
(
summe_non_overlapping_splits
,
n_splits
)
df
=
pd
.
DataFrame
({
'
vid
'
:
original_videos
.
index
.
get_level_values
(
0
),
'
Number of Frames
'
:
original_videos
.
index
.
get_level_values
(
1
),
'
F1-score
'
:
original_videos
.
values
})
df
=
pd
.
DataFrame
({
'
nframes
'
:
original_videos
.
index
,
'
F1-scores
'
:
original_videos
.
values
})
x_axis_stop
=
df
[
'
Number of Frames
'
].
max
()
+
step
x_axis_start
=
df
[
'
Number of Frames
'
].
min
()
plot
=
sns
.
scatterplot
(
x
=
"
nframes
"
,
y
=
"
F1-scores
"
,
data
=
df
)
plt
.
xticks
(
np
.
arange
(
start
=
df
[
'
nframes
'
].
min
(),
stop
=
df
[
'
nframes
'
].
max
(),
step
=
1500
))
plt
.
axhline
(
y
=
df
[
'
F1-scores
'
].
mean
()
+
df
[
'
F1-scores
'
].
std
(),
c
=
'
blue
'
,
linestyle
=
'
dashed
'
,
label
=
"
horizontal
"
)
plt
.
axhline
(
y
=
df
[
'
F1-scores
'
].
mean
()
-
df
[
'
F1-scores
'
].
std
(),
c
=
'
blue
'
,
linestyle
=
'
dashed
'
,
label
=
"
horizontal
"
)
# diff= (non_overlapping_videos.values + original_videos.values)/2
plot
=
sns
.
scatterplot
(
x
=
"
Number of Frames
"
,
y
=
"
F1-score
"
,
data
=
df
)
plt
.
xticks
(
np
.
arange
(
start
=
x_axis_start
,
stop
=
x_axis_stop
,
step
=
step
))
plt
.
yticks
(
np
.
arange
(
start
=
0
,
stop
=
101
,
step
=
10
))
plt
.
axhline
(
y
=
df
[
'
F1-score
'
].
mean
()
+
df
[
'
F1-score
'
].
std
(),
c
=
'
blue
'
,
linestyle
=
'
dashed
'
,
label
=
"
horizontal
"
)
plt
.
axhline
(
y
=
df
[
'
F1-score
'
].
mean
()
-
df
[
'
F1-score
'
].
std
(),
c
=
'
blue
'
,
linestyle
=
'
dashed
'
,
label
=
"
horizontal
"
)
# lowest 10 fscores
print
(
df
.
loc
[
df
[
'
F1-scores
'
].
nsmallest
(
10
).
index
])
# print(df.loc[df['F1-score'].nsmallest(10).index])
sigma1_low
=
df
[
'
F1-score
'
].
mean
()
-
df
[
'
F1-score
'
].
std
()
print
(
df
.
loc
[
df
[
'
F1-score
'
]
<
sigma1_low
])
#plt.yticks(np.arange(-90, 20, step=10))
plt
.
title
(
"
delta F1-score between original and
non-overlapping video splits
"
,
fontsize
=
15
)
labels
=
[
"
v
alues within
1
standard deviation
"
]
#
plt.yticks(np.arange(-90, 20, step=10))
plt
.
title
(
"
SUM-GAN-AAE: F1-scores of
non-overlapping
{}
video splits
w.r.t video length
"
.
format
(
type
)
,
fontsize
=
15
)
labels
=
[
"
V
alues within standard deviation
of 1
"
]
handles
,
_
=
plot
.
get_legend_handles_labels
()
# Slicdfe list to remove first handle
plt
.
legend
(
handles
=
handles
[:],
labels
=
labels
)
# Slicdfe list to remove first handle
plt
.
legend
(
handles
=
handles
[:],
labels
=
labels
)
plt
.
show
()
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