Skip to content
This repository was archived by the owner on Jul 18, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions configs/default/components/problems/image_text_to_class/gqa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# This file defines the default values for the GQA problem.

####################################################################
# 1. CONFIGURATION PARAMETERS that will be LOADED by the component.
####################################################################

# Folder where problem will store data (LOADED)
data_folder: '~/data/gqa'

# Defines the set (split) that will be used (LOADED)
# Options: training_0 | training | validation | test_dev | test | challenge | submission (?)
# Note: test_dev should be used for validation.
split: training_0

# Flag indicating whether the problem will load and return images (LOADED)
stream_images: True

# Resize parameter (LOADED)
# When present, resizes the images from original size to [height, width]
# Depth remains set to 3.
resize_image: [224, 224]

# Select applied image preprocessing/augmentations (LOADED)
# Use one (or more) of the affine transformations:
# none | normalize | all
# Accepted formats: a,b,c or [a,b,c]
image_preprocessing: none

streams:
####################################################################
# 2. Keymappings associated with INPUT and OUTPUT streams.
####################################################################

# Stream containing batch of indices (OUTPUT)
# Every problem MUST return that stream.
indices: indices

# Stream containing batch of sample (original) identifiers (OUTPUT)
sample_ids: sample_ids

# Stream containing batch of images (OUTPUT)
images: images

# Stream containing batch of image names (OUTPUT)
image_ids: image_ids

# Stream containing batch of questions (OUTPUT)
questions: questions

# Stream containing targets answers (labels) (OUTPUT)
answers: answers

# Stream containing targets answers consisting of many words (OUTPUT)
full_answers: full_answers

# Stream containing scene descriptions (OUTPUT)
#answers: scene_graphs

globals:
####################################################################
# 3. Keymappings of variables that will be RETRIEVED from GLOBALS.
####################################################################

####################################################################
# 4. Keymappings associated with GLOBAL variables that will be SET.
####################################################################

# Width of the image (SET)
input_width: image_width
# Height of the image (SET)
input_height: image_height
# Depth of the image (SET)
input_depth: image_depth

####################################################################
# 5. Keymappings associated with statistics that will be ADDED.
####################################################################
8 changes: 2 additions & 6 deletions ptp/components/problems/image_text_to_class/clevr.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ def __init__(self, name, config):
# Call constructors of parent classes.
Problem.__init__(self, name, CLEVR, config)

# (Eventually) download required packages.
#nltk.download('punkt')
#nltk.download('stopwords')

# Get key mappings of all output streams.
self.key_images = self.stream_keys["images"]
self.key_image_ids = self.stream_keys["image_ids"]
Expand Down Expand Up @@ -246,7 +242,7 @@ def output_data_definitions(self):
d[self.key_questions] = DataDefinition([-1, 1], [list, str], "Batch of questions, each being a string consisting of many words [BATCH_SIZE] x [STRING]")

# Add stream with answers.
d[self.key_answers]= DataDefinition([-1, 1], [list, str], "Batch of target answers, each being a string consisting of many words [BATCH_SIZE] x [STRING]")
d[self.key_answers]= DataDefinition([-1, 1], [list, str], "Batch of target answers, each being a string consisting of sinlge word (label) [BATCH_SIZE] x [STRING]")

return d

Expand All @@ -271,7 +267,7 @@ def load_dataset(self, source_data_file):
dataset = []

with open(source_data_file) as f:
self.logger.info('Loading samples from {} ...'.format(source_data_file))
self.logger.info("Loading samples from '{}'...".format(source_data_file))
dataset = json.load(f)['questions']

self.logger.info("Loaded dataset consisting of {} samples".format(len(dataset)))
Expand Down
Loading