MCPcopy
hub / github.com/hanzhanggit/StackGAN / readCaptions

Method readCaptions

misc/datasets.py:57–67  ·  view source on GitHub ↗
(self, filenames, class_id)

Source from the content-addressed store, hash-verified

55 return self._saveIDs
56
57 def readCaptions(self, filenames, class_id):
58 name = filenames
59 if name.find('jpg/') != -1: # flowers dataset
60 class_name = 'class_%05d/' % class_id
61 name = name.replace('jpg/', class_name)
62 cap_path = '%s/text_c10/%s.txt' %\
63 (self.workdir, name)
64 with open(cap_path, "r") as f:
65 captions = f.read().split('\n')
66 captions = [cap for cap in captions if len(cap) > 0]
67 return captions
68
69 def transform(self, images):
70 if self._aug_flag:

Callers 2

sample_embeddingsMethod · 0.95
next_batch_testMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected