Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
GenVQA
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor 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
Vision
GenVQA
Commits
aaa62dc8
Commit
aaa62dc8
authored
8 years ago
by
tgupta6
Browse files
Options
Downloads
Patches
Plain Diff
count_objects_in_vqa
parent
15aa9fc0
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
object_attribute_classifier_cached_features/count_objects_in_vqa.py
+41
-0
41 additions, 0 deletions
...ribute_classifier_cached_features/count_objects_in_vqa.py
with
41 additions
and
0 deletions
object_attribute_classifier_cached_features/count_objects_in_vqa.py
0 → 100644
+
41
−
0
View file @
aaa62dc8
import
ujson
import
nltk
import
os
import
constants
if
__name__
==
'
__main__
'
:
with
open
(
constants
.
vqa_train_anno
)
as
file
:
vqa_train_anno
=
ujson
.
load
(
file
)
with
open
(
constants
.
vqa_train_subset_qids
)
as
file
:
train_subset_qids
=
ujson
.
load
(
file
)
with
open
(
constants
.
object_labels_json
)
as
file
:
object_labels
=
ujson
.
load
(
file
)
freq
=
dict
()
for
label
in
object_labels
.
keys
():
freq
[
label
]
=
0
for
qid
in
train_subset_qids
:
for
noun
in
vqa_train_anno
[
qid
][
'
question_nouns
'
]:
if
noun
in
freq
:
freq
[
noun
]
+=
1
break
for
noun
in
vqa_train_anno
[
qid
][
'
multiple_choice_answer
'
].
split
():
if
noun
in
freq
:
freq
[
noun
]
+=
1
break
freq_filename
=
os
.
path
.
join
(
'
/home/ssd/VisualGenome/restructured
'
,
'
object_label_freq_in_vqa_train_subset.json
'
)
with
open
(
freq_filename
,
'
w
'
)
as
file
:
ujson
.
dump
(
freq
,
file
)
print
freq
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