Is it possible to use the python sdk to get the number of images that have a certain tag in a project?

I found this sdk command: Search - Roboflow Docs

and used it in my code BUT this doesnt work and doesnt get all instances of images with the tags - this command seems buggy, my code:

shows breakdown of no of enviroments in dataset

def show_enviroment_split(project,wi_sar_imgs=0,al_sar_imgs=0,ma_sar_imgs=0):

count wilderness SAR images in dataset

for page in project.search_all(
tag = “WiSAR”,
): wi_sar_imgs += 1

count alpine SAR images

for page in project.search_all(
tag = “AlSAR”,
): al_sar_imgs += 1

count maritime SAR images

for page in project.search_all(
tag = “MiSAR”,
): ma_sar_imgs += 1

Data for plotting

sar_types = [‘MiSAR’, ‘AlSAR’, ‘WiSAR’]

counts = [ma_sar_imgs, al_sar_imgs, wi_sar_imgs]

Creating the bar graph

plt.figure(figsize=(10, 6))
plt.bar(sar_types, counts, color=[‘blue’, ‘green’, ‘red’])
plt.title(‘Count of SAR Images by Type’)
plt.xlabel(‘Search and Rescue Types’)
plt.ylabel(‘Image Counts’)
plt.show()

This is for a an object detection task, relevant ids:

project = rf.workspace(“sar-datasets”).project(“sard-94e95”)
version = project.version(2)
dataset = version.download(“coco”)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.