Anchor Box Generation
**Problem Statement:** Given a set of anchor scales and aspect ratios, generate anchor boxes of different sizes and aspect ratios at each location in a feature map. Anchor boxes are used in object detection tasks to propose potential bounding boxes for objects in an image.
**Example:** If we have anchor scales [8, 16, 32] and aspect ratios [0.5, 1, 2], we want to generate anchor boxes at each location in a feature map with size 7x7.
**Constraints:** The anchor boxes should be generated at each location in the feature map, and their sizes and aspect ratios should match the given anchor scales and aspect ratios.
Test Cases
Test Case 1
Input:
{"feature_map_size": [7, 7], "anchor_scales": [8, 16, 32], "anchor_aspect_ratios": [0.5, 1, 2]}Expected:
[[[[0. 0. 16. 8.]
[0. 0. 16. 8.]
...
[6. 6. 16. 8.]
[6. 6. 16. 8.]],
[[0. 1. 32. 16.]
[0. 1. 32. 16.]
...
[6. 6. 32. 16.]
[6. 6. 32. 16.]],
...
[[0. 6. 8. 4.]
[0. 6. 8. 4.]
...
[6. 6. 8. 4.]
[6. 6. 8. 4.]]]]Test Case 2
Input:
{"feature_map_size": [10, 10], "anchor_scales": [8, 16, 32], "anchor_aspect_ratios": [0.5, 1, 2]}Expected:
[[[[0. 0. 16. 8.]
[0. 0. 16. 8.]
...
[9. 9. 16. 8.]
[9. 9. 16. 8.]],
[[0. 1. 32. 16.]
[0. 1. 32. 16.]
...
[9. 9. 32. 16.]
[9. 9. 32. 16.]],
...
[[0. 9. 8. 4.]
[0. 9. 8. 4.]
...
[9. 9. 8. 4.]
[9. 9. 8. 4.]]]]+ 3 hidden test cases