You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: vision_agent/tools/tools.py
+123Lines changed: 123 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -395,6 +395,127 @@ def __call__(
395
395
returnrets
396
396
397
397
398
+
classZeroShotCounting(Tool):
399
+
r"""ZeroShotCounting is a tool that can count total number of instances of an object
400
+
present in an image belonging to same class without a text or visual prompt.
401
+
402
+
Example
403
+
-------
404
+
>>> import vision_agent as va
405
+
>>> zshot_count = va.tools.ZeroShotCounting()
406
+
>>> zshot_count("image1.jpg")
407
+
{'count': 45}
408
+
"""
409
+
410
+
name="zero_shot_counting_"
411
+
description="""'zero_shot_counting_' is a tool that can count total number of instances of an object present in an image belonging to the same class without a text or visual prompt.
412
+
It returns the total count of the objects."""
413
+
usage= {
414
+
"required_parameters": [
415
+
{"name": "image", "type": "str"},
416
+
],
417
+
"examples": [
418
+
{
419
+
"scenario": "Can you count the lids in the image ? Image name: lids.jpg",
420
+
"parameters": {"image": "lids.jpg"},
421
+
},
422
+
{
423
+
"scenario": "Can you count the total number of objects in this image ? Image name: tray.jpg",
424
+
"parameters": {"image": "tray.jpg"},
425
+
},
426
+
{
427
+
"scenario": "Can you build me an object counting tool ? Image name: shirts.jpg",
428
+
"parameters": {
429
+
"image": "shirts.jpg",
430
+
},
431
+
},
432
+
],
433
+
}
434
+
435
+
# TODO: Add support for input multiple images, which aligns with the output type.
description="""'visual_prompt_counting_' is a tool that can count total number of instances of an object present in an image belonging to the same class given an
467
+
example bounding box around a single instance. It returns the total count of the objects."""
468
+
469
+
usage= {
470
+
"required_parameters": [
471
+
{"name": "image", "type": "str"},
472
+
{"name": "prompt", "type": "str"},
473
+
],
474
+
"examples": [
475
+
{
476
+
"scenario": "Here is an example of a lid '200, 200, 250, 300', Can you count the lids in the image ? Image name: lids.jpg",
0 commit comments