Commit 97a69bbd authored by Amir MOHAMMADI's avatar Amir MOHAMMADI

OrderedDefaultDict does not work on Python 3

parent 4ac7e8e0
from collections import OrderedDict, defaultdict
from collections import OrderedDict
from os.path import join, dirname, abspath, sep
from glob import glob
import random
......@@ -8,14 +8,6 @@ from bob.io.base import create_directories_safe
from .common import swan_bio_file_metadata
class OrderedDefaultDict(OrderedDict, defaultdict):
# from https://stackoverflow.com/a/35968897/1286165
def __init__(self, default_factory=None, *args, **kwargs):
# in python3 you can omit the args to super
super(OrderedDefaultDict, self).__init__(*args, **kwargs)
self.default_factory = default_factory
def create_subparser(subparsers):
parser = subparsers.add_parser(
'create', help="Creates the PAD file lists of the dataset.")
......@@ -25,8 +17,12 @@ def create_subparser(subparsers):
parser.set_defaults(func=_create) # action
PAD_PROTOCOLS = OrderedDefaultDict(
lambda: OrderedDefaultDict(OrderedDefaultDict))
PAD_PROTOCOLS = OrderedDict()
for pa in ['PA.F.1', 'PA.F.5', 'PA.F.6', 'PA.V.4', 'PA.V.7']:
PAD_PROTOCOLS[pa] = OrderedDict()
PAD_PROTOCOLS[pa]['attack'] = OrderedDict()
PAD_PROTOCOLS[pa]['real'] = OrderedDict()
PAD_PROTOCOLS['PA.F.1']['attack']['train'] = ([1], .5, 'iPhone')
PAD_PROTOCOLS['PA.F.1']['attack']['dev'] = ([1], .2, 'iPhone')
PAD_PROTOCOLS['PA.F.1']['attack']['eval'] = ([1], .3, 'iPhone')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment