Skip to content

Commit a392514

Browse files
committed
use local variable scope and fixed minor docstring formatting
1 parent 941682b commit a392514

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

test/fakedata_generation.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,12 @@ def vggface2_root():
176176
"""
177177
Generates a dataset with the following folder structure and returns the path root:
178178
<root>
179-
└── vggface2
180-
├── bb_landmark.tar.gz ('bb_landmark' when uncompressed)
181-
├── vggface2_train.tar.gz ('train' when uncompressed)
182-
├── vggface2_test.tar.gz ('test' when uncompressed)
183-
├── train_list.txt
184-
└── test_list.txt
179+
└── vggface2
180+
├── bb_landmark.tar.gz ('bb_landmark' when uncompressed)
181+
├── vggface2_train.tar.gz ('train' when uncompressed)
182+
├── vggface2_test.tar.gz ('test' when uncompressed)
183+
├── train_list.txt
184+
└── test_list.txt
185185
186186
The dataset consist of 1 image in the train set and 1 image in the test set.
187187
"""
@@ -232,8 +232,8 @@ def _make_test_archive(root):
232232
_make_tar(test_archive, top_level_dir, arcname='test', compress=True)
233233

234234
def _make_bb_landmark_archive(root):
235-
train_bb_contents = 'NAME_ID,X,Y,W,H\n"n000001/0001_01",161,140,224,324'
236-
test_bb_contents = 'NAME_ID,X,Y,W,H\n"n000001/0001_01",161,140,224,324'
235+
train_bbox_contents = 'NAME_ID,X,Y,W,H\n"n000001/0001_01",161,140,224,324'
236+
test_bbox_contents = 'NAME_ID,X,Y,W,H\n"n000001/0001_01",161,140,224,324'
237237
train_landmark_contents = ('NAME_ID,P1X,P1Y,P2X,P2Y,P3X,P3Y,P4X,P4Y,P5X,P5Y\n'
238238
'"n000001/0001_01",75.81253,110.2077,103.1778,104.6074,'
239239
'90.06353,133.3624,85.39182,149.4176,114.9009,144.9259')
@@ -248,12 +248,12 @@ def _make_bb_landmark_archive(root):
248248
# bbox training file
249249
bbox_file = os.path.join(extracted_dir, "loose_bb_train.csv")
250250
with open(bbox_file, "w") as csv_file:
251-
csv_file.write(train_bb_contents)
251+
csv_file.write(train_bbox_contents)
252252

253253
# bbox testing file
254254
bbox_file = os.path.join(extracted_dir, "loose_bb_test.csv")
255255
with open(bbox_file, "w") as csv_file:
256-
csv_file.write(test_bb_contents)
256+
csv_file.write(test_bbox_contents)
257257

258258
# landmark training file
259259
landmark_file = os.path.join(extracted_dir, "loose_landmark_train.csv")

torchvision/datasets/vggface2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def __init__(
9595
raise RuntimeError("target_transform is specified but target_type is empty")
9696

9797
image_list_file = "train_list.txt" if self.split == "train" else "test_list.txt"
98-
self.image_list_file = os.path.join(self.root, image_list_file)
98+
image_list_file = os.path.join(self.root, image_list_file)
9999

100100
# prepare dataset
101101
for (filename, _, extracted_dir) in self.file_list:
@@ -113,7 +113,7 @@ def __init__(
113113
pandas.read_csv(fn("loose_landmark_test.csv"), index_col=0)]
114114
self.landmarks = pandas.concat(landmark_frames)
115115

116-
with open(self.image_list_file, 'r') as f:
116+
with open(image_list_file, 'r') as f:
117117
for img_file in f:
118118
img_file = img_file.strip()
119119
img_filename, ext = os.path.splitext(img_file) # e.g. ["n004332/0317_01", "jpg"]

0 commit comments

Comments
 (0)