class obj:
def __init(self, image_set, year):
self._year = year
self._image_set = image_set
__sets = {}
for year in ['2007', '2012']:
for split in ['train', 'val', 'trainval', 'test']:
name = 'voc_{}_{}'.format(year, split)
__sets[name] = (lambda split=split, year=year: obj(split, year))
我无法在每个函数lambda中访问值“ split”和“ year”