Exemple #1
0
def cornet_s10rep_brainmodel():
    activations_model = cornet('CORnet-S')
    old_times = activations_model._model.IT.times
    new_times = 10
    activations_model._model.IT.times = new_times
    size_12 = activations_model._model.IT.norm1_0.num_features
    size_3 = activations_model._model.IT.norm3_0.num_features
    for t in range(old_times, new_times):
        setattr(activations_model._model.IT, f'norm1_{t}',
                nn.BatchNorm2d(size_12))
        setattr(activations_model._model.IT, f'norm2_{t}',
                nn.BatchNorm2d(size_12))
        setattr(activations_model._model.IT, f'norm3_{t}',
                nn.BatchNorm2d(size_3))
    identifier = f'CORnet-S{new_times}rep'
    activations_model.identifier = identifier
    time_step_size = 10
    time_mapping = {
        timestep:
        (70 + timestep * time_step_size, 70 + (timestep + 1) * time_step_size)
        for timestep in range(0, new_times)
    }
    return CORnetCommitment(
        identifier=identifier,
        activations_model=activations_model,
        layers=['V1.output-t0'] + [
            f'{area}.output-t{timestep}'
            for area, timesteps in [('V2', range(2)), ('V4', range(4)),
                                    ('IT', range(2))] for timestep in timesteps
        ] + ['decoder.avgpool-t0'],
        time_mapping={'IT': time_mapping})
Exemple #2
0
def cornet_r2_brainmodel():
    return CORnetCommitment(identifier='CORnet-R2',
                            activations_model=cornet('CORnet-R2'),
                            layers=['V1.output-t0'] + [
                                f'{area}.output-t{timestep}'
                                for area in ['V2', 'V4', 'IT']
                                for timestep in range(5)
                            ] + ['avgpool-t0'],
                            time_mapping={
                                'V1': {
                                    0: (50, 150)
                                },
                                'V2': {
                                    0: (50, 80),
                                    1: (80, 110),
                                    2: (110, 140),
                                    3: (140, 170),
                                    4: (170, 200)
                                },
                                'V4': {
                                    0: (70, 110),
                                    1: (110, 140),
                                    2: (140, 170),
                                    3: (170, 200),
                                    4: (200, 250)
                                },
                                'IT': {
                                    0: (70, 110),
                                    1: (110, 140),
                                    2: (140, 170),
                                    3: (170, 200),
                                    4: (200, 250)
                                },
                            })
Exemple #3
0
def cornet_s_brainmodel():
    # map region -> (time_start, time_step_size, timesteps)
    time_mappings = CORNET_S_TIMEMAPPING
    return CORnetCommitment(
        identifier='CORnet-S',
        activations_model=cornet('CORnet-S'),
        layers=['V1.output-t0'] + [
            f'{area}.output-t{timestep}'
            for area, timesteps in [('V2', range(2)), ('V4', range(4)),
                                    ('IT', range(2))] for timestep in timesteps
        ] + ['decoder.avgpool-t0'],
        time_mapping=_build_time_mappings(time_mappings))
Exemple #4
0
def cornet_s222_brainmodel():
    time_start, time_step_size = 70, 100
    time_mapping = {
        timestep: (time_start + timestep * time_step_size,
                   time_start + (timestep + 1) * time_step_size)
        for timestep in range(0, 2)
    }
    return CORnetCommitment(
        identifier='CORnet-S222',
        activations_model=cornet('CORnet-S222'),
        layers=['V1.output-t0'] + [
            f'{area}.output-t{timestep}'
            for area, timesteps in [('V2', range(2)), ('V4', range(4)),
                                    ('IT', range(2))] for timestep in timesteps
        ] + ['decoder.avgpool-t0'],
        time_mapping={'IT': time_mapping})
Exemple #5
0
def cornet_s_brainmodel():
    # map region -> (time_start, time_step_size, timesteps)
    time_mappings = {
        'V1': (50, 100, 1),
        'V2': (70, 100, 2),
        # 'V2': (20, 50, 2),  # MS: This follows from the movshon anesthesized-monkey recordings, so might not hold up
        'V4': (90, 50, 4),
        'IT': (100, 100, 2),
    }
    return CORnetCommitment(
        identifier='CORnet-S',
        activations_model=cornet('CORnet-S'),
        layers=['V1.output-t0'] + [
            f'{area}.output-t{timestep}'
            for area, timesteps in [('V2', range(2)), ('V4', range(4)),
                                    ('IT', range(2))] for timestep in timesteps
        ] + ['decoder.avgpool-t0'],
        time_mapping=_build_time_mappings(time_mappings))
Exemple #6
0
def cornet_r10rep_brainmodel():
    activations_model = cornet('CORnet-R')
    new_times = 10
    activations_model._model.times = new_times
    activations_model.identifier = f'CORnet-R{new_times}'
    time_step_size = 10
    time_mapping = {
        timestep:
        (70 + timestep * time_step_size, 70 + (timestep + 1) * time_step_size)
        for timestep in range(0, new_times)
    }
    return CORnetCommitment(identifier=f'CORnet-R{new_times}',
                            activations_model=activations_model,
                            layers=['maxpool-t0'] + [
                                f'{area}.relu3-t{timestep}'
                                for area in ['block2', 'block3', 'block4']
                                for timestep in range(new_times)
                            ] + ['avgpool-t0'],
                            time_mapping={'IT': time_mapping})
Exemple #7
0
def cornet_z_brainmodel():
    return CORnetCommitment(
        identifier='CORnet-Z',
        activations_model=cornet('CORnet-Z'),
        layers=[f'{region}.output-t0' for region in ['V1', 'V2', 'V4', 'IT']] +
        ['decoder.avgpool-t0'],
        time_mapping={
            'V1': {
                0: (50, 150)
            },
            'V2': {
                0: (70, 170)
            },
            'V4': {
                0: (90, 190)
            },
            'IT': {
                0: (100, 200)
            },
        })