INNER CODE UNIT · Python

FCLIPDataset

patrickjohncyh/fashion-clip · fashion_clip/fashion_clip.py:40

class FCLIPDataset:
    # Can initialize as
    # 1. Existing remotely stored catalog (i.e. the one from FF).
    # 2. Specific a new catalog with path to images + corresponding text
    def __init__(self, name: str, image_source_path: str, image_source_type: str,  catalog: List[dict] = None):

        image_source_type = image_source_type.upper()
        assert image_source_type in ['LOCAL', 'S3', 'URL']

        if name in _CATALOGS:
            print('Loading dataset {}...'.format(name))
            catalog_path = _download(_CATALOGS[name], _CACHE_DIR)
            with open(catalog_path, 'rb') as f:
                catalog = json.load(f)
        elif catalog is None:
            raise RuntimeError(f"Catalog {name} not found; available catalogs = {list(_CATALOGS.keys())}")
        self.name = name
        self.catalog = np.array(catalog)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…