コード例 #1
0
def get_overfeat_diff(X1, X2):



    expressions1,affine1 = _get_architecture_2(X1.transpose(0,3,1,2))
    expressions2,affine2 = _get_architecture_2(X2.transpose(0,3,1,2))

    #arch1 = _get_architecture(large_network=True, detailed=False)

    #25 is length
    #output_layers = [1, 4, 8, 11, 13, 14, 17, 19, 21]
    #output_layers = [1]

    #print "USING OVERFEAT FEATURES"

    #expressions1, throwaway = fuse(arch1, output_expressions=output_layers,input_dtype='float32', entry_expression = X1.transpose(0, 3, 1, 2))

    #expressions2, throwaway = fuse(arch1, output_expressions=output_layers,input_dtype='float32', entry_expression = X2.transpose(0, 3, 1, 2))

    diff = 0.0

    for j in range(0, len(affine1)):
        diff += 0.001 * T.sum(T.sqr(affine1[j] - affine2[j]))

    return diff
コード例 #2
0
def get_overfeat_features_2(X1):
    arch1, affine = _get_architecture_2(X1.transpose(0,3,1,2))

    return arch1