Added a feature to count the number of visited images for each category