Repository: activeloopai/Hub
File: deeplake/integrations/mmdet/mmdet_.py (Python)

Code before:
>>>             dict(type='RandomFlip', flip_ratio=0.0),
>>>             dict(type='Normalize', **img_norm_cfg),
>>>             dict(type='Pad', size_divisor=32),
>>>             dict(type='ImageToTensor', keys=['img']),
>>>             dict(type='Collect', keys=['img'])
>>>         ])
>>> ]
>>> #--------------------------------------DEEPLAKE INPUTS------------------------------------------------------------#
>>> TOKEN = "INSERT_YOUR_DEEPLAKE_TOKEN"
​>>> 
>>> 
>>> data = dict(
>>>     # samples_per_gpu=4, # Is used instead of batch_size if deeplake_dataloader is not specified below
>>>     # workers_per_gpu=8, # Is used instead of num_workers if deeplake_dataloader is not specified below
>>>     train=dict(
>>>         pipeline=train_pipeline,
​>>> 
>>>         # Credentials for authentication. See documendataion for deeplake.load() for details
>>>         deeplake_path="hub://activeloop/coco-train",
>>>         deeplake_credentials={
>>>             "username": None,
>>>             "password": None,
>>>             "token": TOKEN,
>>>             "creds": None,
>>>         },
>>>         #OPTIONAL - Checkout teh specified commit_id before training
>>>         deeplake_commit_id="",
>>>         #OPTIONAL - Loads a dataset view for training based on view_id
>>>         deeplake_view_id="",
​
>>>         # OPTIONAL - {"mmdet_key": "deep_lake_tensor",...} - Maps Deep Lake tensors to MMDET dictionary keys. 
>>>         # If not specified, Deep Lake will auto-infer the mapping, but it might make mistakes if datasets have many tensors
>>>         deeplake_tensors = {"img": "images", "gt_bboxes": "boxes", "gt_labels": "categories", "gt_masks": "masks},
>>>         
>>>         # OPTIONAL - Parameters to use for the Deep Lake dataloader. If unspecified, the integration uses
>>>         # the parameters in other parts of the cfg file such as samples_per_gpu, and others.
>>>         deeplake_dataloader = {"shuffle": True, "batch_size": 4, 'num_workers': 8}
>>>     ),
>>> ​
>>>     # Parameters as the same as for train
>>>     val=dict(
>>>         pipeline=test_pipeline,
>>>         deeplake_path="hub://activeloop/coco-val",
>>>         deeplake_credentials={
>>>             "username": None,
>>>             "password": None,
>>>             "token": TOKEN,
>>>             "creds": None,
>>>         },
>>>         deeplake_tensors = {"img": "images", "gt_bboxes": "boxes", "gt_labels": "categories"},
>>>         deeplake_dataloader = {"shuffle": False, "batch_size": 1, 'num_workers': 8}

Review comment (suggestion):
```suggestion
>>>         #OPTIONAL - Checkout the specified commit_id before training
```

Code after:
>>>             dict(type='RandomFlip', flip_ratio=0.0),
>>>             dict(type='Normalize', **img_norm_cfg),
>>>             dict(type='Pad', size_divisor=32),
>>>             dict(type='ImageToTensor', keys=['img']),
>>>             dict(type='Collect', keys=['img'])
>>>         ])
>>> ]
>>> #--------------------------------------DEEPLAKE INPUTS------------------------------------------------------------#
>>> TOKEN = "INSERT_YOUR_DEEPLAKE_TOKEN"
​>>> 
>>> 
>>> data = dict(
>>>     # samples_per_gpu=4, # Is used instead of batch_size if deeplake_dataloader is not specified below
>>>     # workers_per_gpu=8, # Is used instead of num_workers if deeplake_dataloader is not specified below
>>>     train=dict(
>>>         pipeline=train_pipeline,
​>>> 
>>>         # Credentials for authentication. See documendataion for deeplake.load() for details
>>>         deeplake_path="hub://activeloop/coco-train",
>>>         deeplake_credentials={
>>>             "username": None,
>>>             "password": None,
>>>             "token": TOKEN,
>>>             "creds": None,
>>>         },
>>>         #OPTIONAL - Checkout the specified commit_id before training
>>>         deeplake_commit_id="",
>>>         #OPTIONAL - Loads a dataset view for training based on view_id
>>>         deeplake_view_id="",
​
>>>         # OPTIONAL - {"mmdet_key": "deep_lake_tensor",...} - Maps Deep Lake tensors to MMDET dictionary keys. 
>>>         # If not specified, Deep Lake will auto-infer the mapping, but it might make mistakes if datasets have many tensors
>>>         deeplake_tensors = {"img": "images", "gt_bboxes": "boxes", "gt_labels": "categories", "gt_masks": "masks},
>>>         
>>>         # OPTIONAL - Parameters to use for the Deep Lake dataloader. If unspecified, the integration uses
>>>         # the parameters in other parts of the cfg file such as samples_per_gpu, and others.
>>>         deeplake_dataloader = {"shuffle": True, "batch_size": 4, 'num_workers': 8}
>>>     ),
>>> ​
>>>     # Parameters as the same as for train
>>>     val=dict(
>>>         pipeline=test_pipeline,
>>>         deeplake_path="hub://activeloop/coco-val",
>>>         deeplake_credentials={
>>>             "username": None,
>>>             "password": None,
>>>             "token": TOKEN,
>>>             "creds": None,
>>>         },
>>>         deeplake_tensors = {"img": "images", "gt_bboxes": "boxes", "gt_labels": "categories"},
>>>         deeplake_dataloader = {"shuffle": False, "batch_size": 1, 'num_workers': 8}