def test_subpixel_map():
    subpixel_map_estimator = estimator.SubpixelMap(
        half_support_window=2, disparity_step=1)
    similarities = autograd.Variable(th.Tensor([0.1, 0.4, 0.3, 0.2,
                                                0.3])).view(1, 5, 1, 1)
    disparity = subpixel_map_estimator(similarities).squeeze().item()
    expected_disparity = 1.52
    assert np.isclose(expected_disparity, disparity, atol=1e-4)

    subpixel_map_estimator = estimator.SubpixelMap(
        half_support_window=2, disparity_step=2)
    disparity = subpixel_map_estimator(similarities).squeeze().item()
    expected_disparity = 2.124
    assert np.isclose(expected_disparity, disparity, atol=1e-4)
Ejemplo n.º 2
0
 def default_with_continuous_fully_connected():
     """Returns default network with temporal convolutions."""
     stereo_network = ShallowEventStereo(
         temporal_aggregation_module=temporal_aggregation.
         ContinuousFullyConnected(),
         spatial_aggregation_module=_shallow_spatial_aggregation(),
         matching_module=_shallow_matching_module(),
         estimator_module=estimator.SubpixelMap(half_support_window=2,
                                                disparity_step=1))
     stereo_network.set_maximum_disparity(maximum_disparity=38)
     return stereo_network
Ejemplo n.º 3
0
 def default_with_hand_crafted():
     """Returns default network with hand crafted temporal aggregation."""
     stereo_network = ShallowEventStereo(
         temporal_aggregation_module=Dummy(),
         spatial_aggregation_module=_shallow_spatial_aggregation(
             number_of_input_features=4),
         matching_module=_shallow_matching_module(),
         estimator_module=estimator.SubpixelMap(half_support_window=2,
                                                disparity_step=1))
     stereo_network.set_maximum_disparity(maximum_disparity=38)
     return stereo_network
Ejemplo n.º 4
0
 def default(maximum_disparity=255):
     """Returns network with default parameters."""
     network = PdsNetwork(
         size_adapter_module=size_adapter.SizeAdapter(),
         embedding_module=embedding.Embedding(),
         matching_module=matching.Matching(
             operation=matching.MatchingOperation(), maximum_disparity=0),
         regularization_module=regularization.Regularization(),
         estimator_module=estimator.SubpixelMap())
     network.set_maximum_disparity(maximum_disparity)
     return network
Ejemplo n.º 5
0
 def default_with_hand_crafted(maximum_disparity=63):
     """Returns default network with continuous fully connected."""
     stereo_network = DenseDeepEventStereo(
         size_adapter_module=size_adapter.SizeAdapter(),
         temporal_aggregation_module=Dummy(),
         spatial_aggregation_module=embedding.Embedding(
             number_of_input_features=4),
         matching_module=matching.Matching(
             operation=matching.MatchingOperation(), maximum_disparity=0),
         regularization_module=regularization.Regularization(),
         estimator_module=estimator.SubpixelMap())
     stereo_network.set_maximum_disparity(maximum_disparity)
     return stereo_network
Ejemplo n.º 6
0
 def default_with_temporal_convolutions(maximum_disparity=63):
     """Returns default network with temporal convolutions."""
     stereo_network = DenseDeepEventStereo(
         size_adapter_module=size_adapter.SizeAdapter(),
         temporal_aggregation_module=temporal_aggregation.
         TemporalConvolutional(),
         spatial_aggregation_module=embedding.Embedding(
             number_of_input_features=64),
         matching_module=matching.Matching(
             operation=matching.MatchingOperation(), maximum_disparity=0),
         regularization_module=regularization.Regularization(),
         estimator_module=estimator.SubpixelMap())
     stereo_network.set_maximum_disparity(maximum_disparity)
     return stereo_network