All problems
Object Query Count
Problem
Given a fixed set of DETR-style object queries and the number of real objects in an image, return [matched, unmatched]: the queries assigned to objects and the remaining queries that must predict the no-object class.
The signature is object_query_count(num_queries, num_objects). Return two integers.
Hint
DETR pads every image to a fixed number of queries and learns to output no-object for the extras.
Test cases
case 1
in: [100,7]
expected: [7,93]
case 2
in: [10,10]
expected: [10,0]
case 3
in: [5,2]
expected: [2,3]
case 4
in: [20,0]
expected: [0,20]
Starter codePython
def object_query_count(num_queries, num_objects):
# Your code here
pass4 test cases · run your code against them in the editor