Jiayi-Pan commited on
Commit
ebc812a
1 Parent(s): 0f95093

Update Action-Effect.py

Browse files
Files changed (1) hide show
  1. Action-Effect.py +10 -6
Action-Effect.py CHANGED
@@ -47,8 +47,10 @@ class Action_Effect(datasets.GeneratorBasedBuilder):
47
  "verb noun": datasets.Value("string"),
48
  "effect_sentence_list": datasets.features.Sequence(datasets.Value("string")),
49
  "effect_phrases_list": datasets.features.Sequence(datasets.features.Sequence(datasets.Value("string"))),
50
- "positive_image_list": datasets.features.Sequence(datasets.Image()),
51
- "negative_image_list": datasets.features.Sequence(datasets.Image()),
 
 
52
  }
53
  ),
54
  homepage=_URL,
@@ -81,12 +83,14 @@ class Action_Effect(datasets.GeneratorBasedBuilder):
81
  this_image_root_positive = img_root + vn.replace(" ", "+") + "/positive/"
82
  this_image_root_negative = img_root + vn.replace(" ", "+") + "/positive/"
83
  for img_name in os.listdir(this_image_root_positive):
84
- img_pil = Image.open(this_image_root_positive + img_name)
85
- img_np = asarray(img_pil)
 
86
  this_ae_info["positive_image_list"].append(img_np)
87
  for img_name in os.listdir(this_image_root_negative):
88
- img_pil = Image.open(this_image_root_negative + img_name)
89
- img_np = asarray(img_pil)
 
90
  this_ae_info["negative_image_list"].append(img_np)
91
  yield idx, this_ae_info
92
 
 
47
  "verb noun": datasets.Value("string"),
48
  "effect_sentence_list": datasets.features.Sequence(datasets.Value("string")),
49
  "effect_phrases_list": datasets.features.Sequence(datasets.features.Sequence(datasets.Value("string"))),
50
+ "positive_image_list": datasets.features.Sequence(datasets.Value("string")),
51
+ "negative_image_list": datasets.features.Sequence(datasets.Value("string")),
52
+ # "positive_image_list": datasets.features.Sequence(datasets.Image()),
53
+ # "negative_image_list": datasets.features.Sequence(datasets.Image()),
54
  }
55
  ),
56
  homepage=_URL,
 
83
  this_image_root_positive = img_root + vn.replace(" ", "+") + "/positive/"
84
  this_image_root_negative = img_root + vn.replace(" ", "+") + "/positive/"
85
  for img_name in os.listdir(this_image_root_positive):
86
+ img_np = this_image_root_positive + img_name
87
+ # img_pil = Image.open(this_image_root_positive + img_name)
88
+ # img_np = asarray(img_pil)
89
  this_ae_info["positive_image_list"].append(img_np)
90
  for img_name in os.listdir(this_image_root_negative):
91
+ # img_pil = Image.open(this_image_root_negative + img_name)
92
+ # img_np = asarray(img_pil)
93
+ img_np = this_image_root_negative + img_name
94
  this_ae_info["negative_image_list"].append(img_np)
95
  yield idx, this_ae_info
96