|
1 | 1 | """
|
2 |
| -Deep Lake offers an integration with MMDetection, a popular open-source object detection toolbox based on PyTorch. |
| 2 | +Deep Lake offers an integration with MMDetection, a popular open-source object detection toolbox based on PyTorch. |
3 | 3 | The integration enables users to train models while streaming Deep Lake dataset using the transformation, training, and evaluation tools built by MMDet.
|
4 | 4 |
|
5 | 5 | Learn more about MMDetection `here <https://mmdetection.readthedocs.io/en/latest/>`_.
|
6 | 6 |
|
7 | 7 | Integration Interface
|
8 | 8 | ~~~~~~~~~~~~~~~~~~~~~
|
9 |
| -MMDetection works with configs. Deeplake adopted this strategy, and in order to train MMDet models, you need to create/specify your model |
10 |
| -and training/validation config. Deep Lake integration's logic is almost the same as MMDetection's with some minor modifications. The integrations |
11 |
| -with MMDET occurs in the deeplake.integrations.mmdet module. At a high-level, Deep Lake is responsible for the pytorch dataloader that streams data |
| 9 | +MMDetection works with configs. Deeplake adopted this strategy, and in order to train MMDet models, you need to create/specify your model |
| 10 | +and training/validation config. Deep Lake integration's logic is almost the same as MMDetection's with some minor modifications. The integrations |
| 11 | +with MMDET occurs in the deeplake.integrations.mmdet module. At a high-level, Deep Lake is responsible for the pytorch dataloader that streams data |
12 | 12 | to the training framework, while MMDET is used for the training, transformation, and evaluation logic. Let us take a look at the config with deeplake changes:
|
13 | 13 |
|
14 | 14 | Deeplake integration requires the following parameters to be specified in the configuration file:
|
|
17 | 17 | - ``train``: Keyword argument of data, a dictionary where one can specify dataset path, credentials, transformations of the training data
|
18 | 18 | - ``val``: Keyword argument of data, a dictionary where one can specify dataset path, credentials, transformations of the validation data
|
19 | 19 | - ``pipeline``: List of transformations. This parameter exists for train as well as for val.
|
20 |
| - |
| 20 | +
|
21 | 21 | - Example:
|
22 |
| - |
| 22 | +
|
23 | 23 | >>> pipeline = [dict(type="Resize", img_scale=[(320, 320), (608, 608)], keep_ratio=True), dict(type="RandomFlip", flip_ratio=0.5), dict(type="PhotoMetricDistortion")]
|
24 | 24 |
|
25 | 25 | - ``deeplake_path``: Path to the deeplake dataset. This parameter exists for train as well as for val.
|
|
38 | 38 | - ``"num_workers"``: Number of workers to use. If not specified, dataloader will use ``workers_per_gpu``.
|
39 | 39 |
|
40 | 40 | - ``deeplake_dataloader_type``: Optional parameter. If specified, it represents the type of deeplake dataloader to use.
|
41 |
| -- ``deeplake_metrics_format``: Optional parameter. If specified, it represents the format of the deeplake metrics that will be used during evaluation. Defaults to COCO. |
42 |
| - Avaliable values are: "COCO", "PascalVOC". If COCO format is used, you can specify whether you want to evaluate on bbox only or also want to evaluate on masks. |
43 |
| - To do that you need to specify the format of the metric in metric. |
44 |
| - |
| 41 | +- ``deeplake_metrics_format``: Optional parameter. If specified, it represents the format of the deeplake metrics that will be used during evaluation. Defaults to COCO. |
| 42 | + Avaliable values are: "COCO", "PascalVOC". If COCO format is used, you can specify whether you want to evaluate on bbox only or also want to evaluate on masks. |
| 43 | + To do that you need to specify the format of the metric in metric. |
| 44 | +
|
45 | 45 | Example:
|
46 | 46 |
|
47 | 47 | >>> deeplake_metrics_format = "COCO"
|
|
105 | 105 | ... ])
|
106 | 106 | ... ]
|
107 | 107 | >>> #--------------------------------------DEEPLAKE INPUTS------------------------------------------------------------#
|
108 |
| ->>> TOKEN = "INSERT_YOUR_DEEPLAKE_TOKEN" |
| 108 | +>>> TOKEN = "INSERT_YOUR_DEEPLAKE_TOKEN" |
109 | 109 | >>> data = dict(
|
110 | 110 | ... # samples_per_gpu=4, # Is used instead of batch_size if deeplake_dataloader is not specified below
|
111 | 111 | ... # workers_per_gpu=8, # Is used instead of num_workers if deeplake_dataloader is not specified below
|
|
121 | 121 | ... deeplake_commit_id="",
|
122 | 122 | ... #OPTIONAL - Loads a dataset view for training based on view_id
|
123 | 123 | ... deeplake_view_id="",
|
124 |
| -... # OPTIONAL - {"mmdet_key": "deep_lake_tensor",...} - Maps Deep Lake tensors to MMDET dictionary keys. |
| 124 | +... # OPTIONAL - {"mmdet_key": "deep_lake_tensor",...} - Maps Deep Lake tensors to MMDET dictionary keys. |
125 | 125 | ... # If not specified, Deep Lake will auto-infer the mapping, but it might make mistakes if datasets have many tensors
|
126 |
| -... deeplake_tensors = {"img": "images", "gt_bboxes": "boxes", "gt_labels": "categories", "gt_masks": "masks}, |
| 126 | +... deeplake_tensors = {"img": "images", "gt_bboxes": "boxes", "gt_labels": "categories", "gt_masks": "masks}, |
127 | 127 | ... # OPTIONAL - Parameters to use for the Deep Lake dataloader. If unspecified, the integration uses
|
128 | 128 | ... # the parameters in other parts of the cfg file such as samples_per_gpu, and others.
|
129 | 129 | ... deeplake_dataloader = {"shuffle": True, "batch_size": 4, 'num_workers': 8}
|
|
0 commit comments