def __init__(self, prototxt):
    from os import path
    self.prototxt = prototxt
    self.parsed_proto = parseProtoString(open(self.prototxt, 'r').read())
    self.input_dim = (3, 227, 227)
    net = self.parsed_proto
    if (len(net.input_dim) > 0):
        self.input_dim = net.input_dim[1:]
    else:
        lrs = net.layer
        cs = [l.transform_param.crop_size for l in lrs if l.HasField('transform_param')]
        if len(cs):
            self.input_dim = (3, cs[0], cs[0])
def __init__(self, prototxt):
    from os import path
    self.prototxt = prototxt
    self.parsed_proto = parseProtoString(open(self.prototxt, 'r').read())
    self.input_dim = (3, 227, 227)
    net = self.parsed_proto
    if (len(net.input_dim) > 0):
        self.input_dim = net.input_dim[1:]
    else:
        lrs = net.layer
        cs = [l.transform_param.crop_size for l in lrs if l.HasField('transform_param')]
        if len(cs):
            self.input_dim = (3, cs[0], cs[0])