class_docstr: This helper class wraps the DatasetTemplates class
  - Initialized the DatasetTemplates for all existing template folder
  - Give access to each DatasetTemplates
  - Provides aggregated counts over all DatasetTemplates
class_docstr_tok: ["This","helper","class","wraps","the","DatasetTemplates","class","-","Initialized","the","DatasetTemplates","for","all","existing","template","folder","-","Give","access","to","each","DatasetTemplates","-","Provides","aggregated","counts","over","all","DatasetTemplates"]
docstr: Initialize a DatasetTemplates object for each templates.yaml detected in the templates folder
  
  Returns: a dict with key=(dataset_name, subset_name)
docstr_tok: ["Initialize","a","DatasetTemplates","object","for","each","templates.yaml","detected","in","the","templates","folder","Returns",":","a","dict","with","key=","(","dataset_name",",","subset_name",")"]
code: def _collect_datasets(
      self,
  ) -> Dict[Tuple[str, str], "DatasetTemplates"]:
      """
      Initialize a DatasetTemplates object for each templates.yaml detected in the templates folder
  
      Returns: a dict with key=(dataset_name, subset_name)
      """
      dataset_folders = os.listdir(TEMPLATES_FOLDER_PATH)
      dataset_folders = [
          folder
          for folder in dataset_folders
          if not folder.startswith(".")
      ]
  
      output = (
          {}
      )  # format is {(dataset_name, subset_name): DatasetsTemplates}
      for dataset in dataset_folders:
          if dataset in INCLUDED_USERS:
              for filename in os.listdir(
                  os.path.join(TEMPLATES_FOLDER_PATH, dataset)
              ):
                  output = {
                      **output,
                      **self._collect_dataset(dataset + "/" + filename),
                  }
          else:
              output = {**output, **self._collect_dataset(dataset)}
      return output
  
imports: import logging
  import os
  import random
  import re
  import uuid
  from collections import Counter, defaultdict
  from shutil import rmtree
  from typing import Dict, List, Optional, Tuple
  import pandas
  import pkg_resources
  import yaml
  from jinja2 import BaseLoader, Environment, meta
  from ..constants import AUTOMM
label_desc: Use image node_id 5 for calling the TemplateCollection obj's underlying member method code with example usage: obj._collect_datasets() and returns: output