source
stringclasses 470
values | url
stringlengths 49
167
| file_type
stringclasses 1
value | chunk
stringlengths 1
512
| chunk_id
stringlengths 5
9
|
---|---|---|---|---|
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#preparing-function-to-compute-map | .md | ... Returns:
... torch.Tensor: Bounding boxes in Pascal VOC format (x_min, y_min, x_max, y_max)
... """
... # convert center to corners format
... boxes = center_to_corners_format(boxes)
... # convert to absolute coordinates
... height, width = image_size
... boxes = boxes * torch.tensor([[width, height, width, height]]) | 81_4_3 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#preparing-function-to-compute-map | .md | ... return boxes
```
Then, in `compute_metrics` function we collect `predicted` and `target` bounding boxes, scores and labels from evaluation loop results and pass it to the scoring function.
```py
>>> import numpy as np
>>> from dataclasses import dataclass
>>> from torchmetrics.detection.mean_ap import MeanAveragePrecision
>>> @dataclass
>>> class ModelOutput:
... logits: torch.Tensor
... pred_boxes: torch.Tensor | 81_4_4 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#preparing-function-to-compute-map | .md | >>> @dataclass
>>> class ModelOutput:
... logits: torch.Tensor
... pred_boxes: torch.Tensor
>>> @torch.no_grad()
>>> def compute_metrics(evaluation_results, image_processor, threshold=0.0, id2label=None):
... """
... Compute mean average mAP, mAR and their variants for the object detection task. | 81_4_5 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#preparing-function-to-compute-map | .md | ... Args:
... evaluation_results (EvalPrediction): Predictions and targets from evaluation.
... threshold (float, optional): Threshold to filter predicted boxes by confidence. Defaults to 0.0.
... id2label (Optional[dict], optional): Mapping from class id to class name. Defaults to None.
... Returns:
... Mapping[str, float]: Metrics in a form of dictionary {<metric_name>: <metric_value>}
... """ | 81_4_6 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#preparing-function-to-compute-map | .md | ... Returns:
... Mapping[str, float]: Metrics in a form of dictionary {<metric_name>: <metric_value>}
... """
... predictions, targets = evaluation_results.predictions, evaluation_results.label_ids
... # For metric computation we need to provide:
... # - targets in a form of list of dictionaries with keys "boxes", "labels"
... # - predictions in a form of list of dictionaries with keys "boxes", "scores", "labels" | 81_4_7 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#preparing-function-to-compute-map | .md | ... image_sizes = []
... post_processed_targets = []
... post_processed_predictions = [] | 81_4_8 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#preparing-function-to-compute-map | .md | ... # Collect targets in the required format for metric computation
... for batch in targets:
... # collect image sizes, we will need them for predictions post processing
... batch_image_sizes = torch.tensor(np.array([x["orig_size"] for x in batch]))
... image_sizes.append(batch_image_sizes)
... # collect targets in the required format for metric computation
... # boxes were converted to YOLO format needed for model training | 81_4_9 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#preparing-function-to-compute-map | .md | ... # boxes were converted to YOLO format needed for model training
... # here we will convert them to Pascal VOC format (x_min, y_min, x_max, y_max)
... for image_target in batch:
... boxes = torch.tensor(image_target["boxes"])
... boxes = convert_bbox_yolo_to_pascal(boxes, image_target["orig_size"])
... labels = torch.tensor(image_target["class_labels"])
... post_processed_targets.append({"boxes": boxes, "labels": labels}) | 81_4_10 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#preparing-function-to-compute-map | .md | ... # Collect predictions in the required format for metric computation,
... # model produce boxes in YOLO format, then image_processor convert them to Pascal VOC format
... for batch, target_sizes in zip(predictions, image_sizes):
... batch_logits, batch_boxes = batch[1], batch[2]
... output = ModelOutput(logits=torch.tensor(batch_logits), pred_boxes=torch.tensor(batch_boxes))
... post_processed_output = image_processor.post_process_object_detection( | 81_4_11 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#preparing-function-to-compute-map | .md | ... post_processed_output = image_processor.post_process_object_detection(
... output, threshold=threshold, target_sizes=target_sizes
... )
... post_processed_predictions.extend(post_processed_output) | 81_4_12 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#preparing-function-to-compute-map | .md | ... # Compute metrics
... metric = MeanAveragePrecision(box_format="xyxy", class_metrics=True)
... metric.update(post_processed_predictions, post_processed_targets)
... metrics = metric.compute() | 81_4_13 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#preparing-function-to-compute-map | .md | ... # Replace list of per class metrics with separate metric for each class
... classes = metrics.pop("classes")
... map_per_class = metrics.pop("map_per_class")
... mar_100_per_class = metrics.pop("mar_100_per_class")
... for class_id, class_map, class_mar in zip(classes, map_per_class, mar_100_per_class):
... class_name = id2label[class_id.item()] if id2label is not None else class_id.item()
... metrics[f"map_{class_name}"] = class_map | 81_4_14 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#preparing-function-to-compute-map | .md | ... metrics[f"map_{class_name}"] = class_map
... metrics[f"mar_100_{class_name}"] = class_mar | 81_4_15 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#preparing-function-to-compute-map | .md | ... metrics = {k: round(v.item(), 4) for k, v in metrics.items()}
... return metrics
>>> eval_compute_metrics_fn = partial(
... compute_metrics, image_processor=image_processor, id2label=id2label, threshold=0.0
... )
``` | 81_4_16 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | You have done most of the heavy lifting in the previous sections, so now you are ready to train your model!
The images in this dataset are still quite large, even after resizing. This means that finetuning this model will
require at least one GPU.
Training involves the following steps:
1. Load the model with [`AutoModelForObjectDetection`] using the same checkpoint as in the preprocessing.
2. Define your training hyperparameters in [`TrainingArguments`]. | 81_5_0 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | 2. Define your training hyperparameters in [`TrainingArguments`].
3. Pass the training arguments to [`Trainer`] along with the model, dataset, image processor, and data collator.
4. Call [`~Trainer.train`] to finetune your model.
When loading the model from the same checkpoint that you used for the preprocessing, remember to pass the `label2id` | 81_5_1 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | When loading the model from the same checkpoint that you used for the preprocessing, remember to pass the `label2id`
and `id2label` maps that you created earlier from the dataset's metadata. Additionally, we specify `ignore_mismatched_sizes=True` to replace the existing classification head with a new one.
```py
>>> from transformers import AutoModelForObjectDetection | 81_5_2 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | >>> model = AutoModelForObjectDetection.from_pretrained(
... MODEL_NAME,
... id2label=id2label,
... label2id=label2id,
... ignore_mismatched_sizes=True,
... )
```
In the [`TrainingArguments`] use `output_dir` to specify where to save your model, then configure hyperparameters as you see fit. For `num_train_epochs=30` training will take about 35 minutes in Google Colab T4 GPU, increase the number of epoch to get better results.
Important notes: | 81_5_3 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | Important notes:
- Do not remove unused columns because this will drop the image column. Without the image column, you
can't create `pixel_values`. For this reason, set `remove_unused_columns` to `False`.
- Set `eval_do_concat_batches=False` to get proper evaluation results. Images have different number of target boxes, if batches are concatenated we will not be able to determine which boxes belongs to particular image. | 81_5_4 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | If you wish to share your model by pushing to the Hub, set `push_to_hub` to `True` (you must be signed in to Hugging
Face to upload your model).
```py
>>> from transformers import TrainingArguments | 81_5_5 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | >>> training_args = TrainingArguments(
... output_dir="detr_finetuned_cppe5",
... num_train_epochs=30,
... fp16=False,
... per_device_train_batch_size=8,
... dataloader_num_workers=4,
... learning_rate=5e-5,
... lr_scheduler_type="cosine",
... weight_decay=1e-4,
... max_grad_norm=0.01,
... metric_for_best_model="eval_map",
... greater_is_better=True,
... load_best_model_at_end=True,
... eval_strategy="epoch",
... save_strategy="epoch", | 81_5_6 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | ... load_best_model_at_end=True,
... eval_strategy="epoch",
... save_strategy="epoch",
... save_total_limit=2,
... remove_unused_columns=False,
... eval_do_concat_batches=False,
... push_to_hub=True,
... )
```
Finally, bring everything together, and call [`~transformers.Trainer.train`]:
```py
>>> from transformers import Trainer | 81_5_7 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | >>> trainer = Trainer(
... model=model,
... args=training_args,
... train_dataset=cppe5["train"],
... eval_dataset=cppe5["validation"],
... processing_class=image_processor,
... data_collator=collate_fn,
... compute_metrics=eval_compute_metrics_fn,
... ) | 81_5_8 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | >>> trainer.train()
```
<div>
<progress value='3210' max='3210' style='width:300px; height:20px; vertical-align: middle;'></progress>
[3210/3210 26:07, Epoch 30/30]
</div>
<table border="1" class="dataframe">
<thead>
<tr style="text-align: left;">
<th>Epoch</th>
<th>Training Loss</th>
<th>Validation Loss</th>
<th>Map</th>
<th>Map 50</th>
<th>Map 75</th>
<th>Map Small</th>
<th>Map Medium</th>
<th>Map Large</th>
<th>Mar 1</th>
<th>Mar 10</th>
<th>Mar 100</th>
<th>Mar Small</th>
<th>Mar Medium</th> | 81_5_9 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | <th>Map Medium</th>
<th>Map Large</th>
<th>Mar 1</th>
<th>Mar 10</th>
<th>Mar 100</th>
<th>Mar Small</th>
<th>Mar Medium</th>
<th>Mar Large</th>
<th>Map Coverall</th>
<th>Mar 100 Coverall</th>
<th>Map Face Shield</th>
<th>Mar 100 Face Shield</th>
<th>Map Gloves</th>
<th>Mar 100 Gloves</th>
<th>Map Goggles</th>
<th>Mar 100 Goggles</th>
<th>Map Mask</th>
<th>Mar 100 Mask</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>No log</td>
<td>2.629903</td>
<td>0.008900</td>
<td>0.023200</td>
<td>0.006500</td> | 81_5_10 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | </tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>No log</td>
<td>2.629903</td>
<td>0.008900</td>
<td>0.023200</td>
<td>0.006500</td>
<td>0.001300</td>
<td>0.002800</td>
<td>0.020500</td>
<td>0.021500</td>
<td>0.070400</td>
<td>0.101400</td>
<td>0.007600</td>
<td>0.106200</td>
<td>0.096100</td>
<td>0.036700</td>
<td>0.232000</td>
<td>0.000300</td>
<td>0.019000</td>
<td>0.003900</td>
<td>0.125400</td>
<td>0.000100</td>
<td>0.003100</td>
<td>0.003500</td>
<td>0.127600</td>
</tr>
<tr>
<td>2</td>
<td>No log</td> | 81_5_11 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | <td>0.125400</td>
<td>0.000100</td>
<td>0.003100</td>
<td>0.003500</td>
<td>0.127600</td>
</tr>
<tr>
<td>2</td>
<td>No log</td>
<td>3.479864</td>
<td>0.014800</td>
<td>0.034600</td>
<td>0.010800</td>
<td>0.008600</td>
<td>0.011700</td>
<td>0.012500</td>
<td>0.041100</td>
<td>0.098700</td>
<td>0.130000</td>
<td>0.056000</td>
<td>0.062200</td>
<td>0.111900</td>
<td>0.053500</td>
<td>0.447300</td>
<td>0.010600</td>
<td>0.100000</td>
<td>0.000200</td>
<td>0.022800</td>
<td>0.000100</td>
<td>0.015400</td> | 81_5_12 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | <td>0.447300</td>
<td>0.010600</td>
<td>0.100000</td>
<td>0.000200</td>
<td>0.022800</td>
<td>0.000100</td>
<td>0.015400</td>
<td>0.009700</td>
<td>0.064400</td>
</tr>
<tr>
<td>3</td>
<td>No log</td>
<td>2.107622</td>
<td>0.041700</td>
<td>0.094000</td>
<td>0.034300</td>
<td>0.024100</td>
<td>0.026400</td>
<td>0.047400</td>
<td>0.091500</td>
<td>0.182800</td>
<td>0.225800</td>
<td>0.087200</td>
<td>0.199400</td>
<td>0.210600</td>
<td>0.150900</td>
<td>0.571200</td>
<td>0.017300</td>
<td>0.101300</td> | 81_5_13 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | <td>0.087200</td>
<td>0.199400</td>
<td>0.210600</td>
<td>0.150900</td>
<td>0.571200</td>
<td>0.017300</td>
<td>0.101300</td>
<td>0.007300</td>
<td>0.180400</td>
<td>0.002100</td>
<td>0.026200</td>
<td>0.031000</td>
<td>0.250200</td>
</tr>
<tr>
<td>4</td>
<td>No log</td>
<td>2.031242</td>
<td>0.055900</td>
<td>0.120600</td>
<td>0.046900</td>
<td>0.013800</td>
<td>0.038100</td>
<td>0.090300</td>
<td>0.105900</td>
<td>0.225600</td>
<td>0.266100</td>
<td>0.130200</td>
<td>0.228100</td>
<td>0.330000</td> | 81_5_14 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | <td>0.090300</td>
<td>0.105900</td>
<td>0.225600</td>
<td>0.266100</td>
<td>0.130200</td>
<td>0.228100</td>
<td>0.330000</td>
<td>0.191000</td>
<td>0.572100</td>
<td>0.010600</td>
<td>0.157000</td>
<td>0.014600</td>
<td>0.235300</td>
<td>0.001700</td>
<td>0.052300</td>
<td>0.061800</td>
<td>0.313800</td>
</tr>
<tr>
<td>5</td>
<td>3.889400</td>
<td>1.883433</td>
<td>0.089700</td>
<td>0.201800</td>
<td>0.067300</td>
<td>0.022800</td>
<td>0.065300</td>
<td>0.129500</td>
<td>0.136000</td>
<td>0.272200</td> | 81_5_15 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | <td>0.201800</td>
<td>0.067300</td>
<td>0.022800</td>
<td>0.065300</td>
<td>0.129500</td>
<td>0.136000</td>
<td>0.272200</td>
<td>0.303700</td>
<td>0.112900</td>
<td>0.312500</td>
<td>0.424600</td>
<td>0.300200</td>
<td>0.585100</td>
<td>0.032700</td>
<td>0.202500</td>
<td>0.031300</td>
<td>0.271000</td>
<td>0.008700</td>
<td>0.126200</td>
<td>0.075500</td>
<td>0.333800</td>
</tr>
<tr>
<td>6</td>
<td>3.889400</td>
<td>1.807503</td>
<td>0.118500</td>
<td>0.270900</td>
<td>0.090200</td>
<td>0.034900</td> | 81_5_16 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | <tr>
<td>6</td>
<td>3.889400</td>
<td>1.807503</td>
<td>0.118500</td>
<td>0.270900</td>
<td>0.090200</td>
<td>0.034900</td>
<td>0.076700</td>
<td>0.152500</td>
<td>0.146100</td>
<td>0.297800</td>
<td>0.325400</td>
<td>0.171700</td>
<td>0.283700</td>
<td>0.545900</td>
<td>0.396900</td>
<td>0.554500</td>
<td>0.043000</td>
<td>0.262000</td>
<td>0.054500</td>
<td>0.271900</td>
<td>0.020300</td>
<td>0.230800</td>
<td>0.077600</td>
<td>0.308000</td>
</tr>
<tr>
<td>7</td>
<td>3.889400</td>
<td>1.716169</td> | 81_5_17 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | <td>0.230800</td>
<td>0.077600</td>
<td>0.308000</td>
</tr>
<tr>
<td>7</td>
<td>3.889400</td>
<td>1.716169</td>
<td>0.143500</td>
<td>0.307700</td>
<td>0.123200</td>
<td>0.045800</td>
<td>0.097800</td>
<td>0.258300</td>
<td>0.165300</td>
<td>0.327700</td>
<td>0.352600</td>
<td>0.140900</td>
<td>0.336700</td>
<td>0.599400</td>
<td>0.442900</td>
<td>0.620700</td>
<td>0.069400</td>
<td>0.301300</td>
<td>0.081600</td>
<td>0.292000</td>
<td>0.011000</td>
<td>0.230800</td>
<td>0.112700</td>
<td>0.318200</td> | 81_5_18 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | <td>0.301300</td>
<td>0.081600</td>
<td>0.292000</td>
<td>0.011000</td>
<td>0.230800</td>
<td>0.112700</td>
<td>0.318200</td>
</tr>
<tr>
<td>8</td>
<td>3.889400</td>
<td>1.679014</td>
<td>0.153000</td>
<td>0.355800</td>
<td>0.127900</td>
<td>0.038700</td>
<td>0.115600</td>
<td>0.291600</td>
<td>0.176000</td>
<td>0.322500</td>
<td>0.349700</td>
<td>0.135600</td>
<td>0.326100</td>
<td>0.643700</td>
<td>0.431700</td>
<td>0.582900</td>
<td>0.069800</td>
<td>0.265800</td>
<td>0.088600</td>
<td>0.274600</td> | 81_5_19 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | <td>0.643700</td>
<td>0.431700</td>
<td>0.582900</td>
<td>0.069800</td>
<td>0.265800</td>
<td>0.088600</td>
<td>0.274600</td>
<td>0.028300</td>
<td>0.280000</td>
<td>0.146700</td>
<td>0.345300</td>
</tr>
<tr>
<td>9</td>
<td>3.889400</td>
<td>1.618239</td>
<td>0.172100</td>
<td>0.375300</td>
<td>0.137600</td>
<td>0.046100</td>
<td>0.141700</td>
<td>0.308500</td>
<td>0.194000</td>
<td>0.356200</td>
<td>0.386200</td>
<td>0.162400</td>
<td>0.359200</td>
<td>0.677700</td>
<td>0.469800</td>
<td>0.623900</td> | 81_5_20 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | <td>0.356200</td>
<td>0.386200</td>
<td>0.162400</td>
<td>0.359200</td>
<td>0.677700</td>
<td>0.469800</td>
<td>0.623900</td>
<td>0.102100</td>
<td>0.317700</td>
<td>0.099100</td>
<td>0.290200</td>
<td>0.029300</td>
<td>0.335400</td>
<td>0.160200</td>
<td>0.364000</td>
</tr>
<tr>
<td>10</td>
<td>1.599700</td>
<td>1.572512</td>
<td>0.179500</td>
<td>0.400400</td>
<td>0.147200</td>
<td>0.056500</td>
<td>0.141700</td>
<td>0.316700</td>
<td>0.213100</td>
<td>0.357600</td>
<td>0.381300</td>
<td>0.197900</td> | 81_5_21 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | <td>0.056500</td>
<td>0.141700</td>
<td>0.316700</td>
<td>0.213100</td>
<td>0.357600</td>
<td>0.381300</td>
<td>0.197900</td>
<td>0.344300</td>
<td>0.638500</td>
<td>0.466900</td>
<td>0.623900</td>
<td>0.101300</td>
<td>0.311400</td>
<td>0.104700</td>
<td>0.279500</td>
<td>0.051600</td>
<td>0.338500</td>
<td>0.173000</td>
<td>0.353300</td>
</tr>
<tr>
<td>11</td>
<td>1.599700</td>
<td>1.528889</td>
<td>0.192200</td>
<td>0.415000</td>
<td>0.160800</td>
<td>0.053700</td>
<td>0.150500</td>
<td>0.378000</td> | 81_5_22 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | <td>1.528889</td>
<td>0.192200</td>
<td>0.415000</td>
<td>0.160800</td>
<td>0.053700</td>
<td>0.150500</td>
<td>0.378000</td>
<td>0.211500</td>
<td>0.371700</td>
<td>0.397800</td>
<td>0.204900</td>
<td>0.374600</td>
<td>0.684800</td>
<td>0.491900</td>
<td>0.632400</td>
<td>0.131200</td>
<td>0.346800</td>
<td>0.122000</td>
<td>0.300900</td>
<td>0.038400</td>
<td>0.344600</td>
<td>0.177500</td>
<td>0.364400</td>
</tr>
<tr>
<td>12</td>
<td>1.599700</td>
<td>1.517532</td>
<td>0.198300</td>
<td>0.429800</td> | 81_5_23 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | <td>0.364400</td>
</tr>
<tr>
<td>12</td>
<td>1.599700</td>
<td>1.517532</td>
<td>0.198300</td>
<td>0.429800</td>
<td>0.159800</td>
<td>0.066400</td>
<td>0.162900</td>
<td>0.383300</td>
<td>0.220700</td>
<td>0.382100</td>
<td>0.405400</td>
<td>0.214800</td>
<td>0.383200</td>
<td>0.672900</td>
<td>0.469000</td>
<td>0.610400</td>
<td>0.167800</td>
<td>0.379700</td>
<td>0.119700</td>
<td>0.307100</td>
<td>0.038100</td>
<td>0.335400</td>
<td>0.196800</td>
<td>0.394200</td>
</tr>
<tr>
<td>13</td> | 81_5_24 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | <td>0.307100</td>
<td>0.038100</td>
<td>0.335400</td>
<td>0.196800</td>
<td>0.394200</td>
</tr>
<tr>
<td>13</td>
<td>1.599700</td>
<td>1.488849</td>
<td>0.209800</td>
<td>0.452300</td>
<td>0.172300</td>
<td>0.094900</td>
<td>0.171100</td>
<td>0.437800</td>
<td>0.222000</td>
<td>0.379800</td>
<td>0.411500</td>
<td>0.203800</td>
<td>0.397300</td>
<td>0.707500</td>
<td>0.470700</td>
<td>0.620700</td>
<td>0.186900</td>
<td>0.407600</td>
<td>0.124200</td>
<td>0.306700</td>
<td>0.059300</td>
<td>0.355400</td> | 81_5_25 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | <td>0.620700</td>
<td>0.186900</td>
<td>0.407600</td>
<td>0.124200</td>
<td>0.306700</td>
<td>0.059300</td>
<td>0.355400</td>
<td>0.207700</td>
<td>0.367100</td>
</tr>
<tr>
<td>14</td>
<td>1.599700</td>
<td>1.482210</td>
<td>0.228900</td>
<td>0.482600</td>
<td>0.187800</td>
<td>0.083600</td>
<td>0.191800</td>
<td>0.444100</td>
<td>0.225900</td>
<td>0.376900</td>
<td>0.407400</td>
<td>0.182500</td>
<td>0.384800</td>
<td>0.700600</td>
<td>0.512100</td>
<td>0.640100</td>
<td>0.175000</td>
<td>0.363300</td> | 81_5_26 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | <td>0.182500</td>
<td>0.384800</td>
<td>0.700600</td>
<td>0.512100</td>
<td>0.640100</td>
<td>0.175000</td>
<td>0.363300</td>
<td>0.144300</td>
<td>0.300000</td>
<td>0.083100</td>
<td>0.363100</td>
<td>0.229900</td>
<td>0.370700</td>
</tr>
<tr>
<td>15</td>
<td>1.326800</td>
<td>1.475198</td>
<td>0.216300</td>
<td>0.455600</td>
<td>0.174900</td>
<td>0.088500</td>
<td>0.183500</td>
<td>0.424400</td>
<td>0.226900</td>
<td>0.373400</td>
<td>0.404300</td>
<td>0.199200</td>
<td>0.396400</td>
<td>0.677800</td> | 81_5_27 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | <td>0.424400</td>
<td>0.226900</td>
<td>0.373400</td>
<td>0.404300</td>
<td>0.199200</td>
<td>0.396400</td>
<td>0.677800</td>
<td>0.496300</td>
<td>0.633800</td>
<td>0.166300</td>
<td>0.392400</td>
<td>0.128900</td>
<td>0.312900</td>
<td>0.085200</td>
<td>0.312300</td>
<td>0.205000</td>
<td>0.370200</td>
</tr>
<tr>
<td>16</td>
<td>1.326800</td>
<td>1.459697</td>
<td>0.233200</td>
<td>0.504200</td>
<td>0.192200</td>
<td>0.096000</td>
<td>0.202000</td>
<td>0.430800</td>
<td>0.239100</td>
<td>0.382400</td> | 81_5_28 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | <td>0.504200</td>
<td>0.192200</td>
<td>0.096000</td>
<td>0.202000</td>
<td>0.430800</td>
<td>0.239100</td>
<td>0.382400</td>
<td>0.412600</td>
<td>0.219500</td>
<td>0.403100</td>
<td>0.670400</td>
<td>0.485200</td>
<td>0.625200</td>
<td>0.196500</td>
<td>0.410100</td>
<td>0.135700</td>
<td>0.299600</td>
<td>0.123100</td>
<td>0.356900</td>
<td>0.225300</td>
<td>0.371100</td>
</tr>
<tr>
<td>17</td>
<td>1.326800</td>
<td>1.407340</td>
<td>0.243400</td>
<td>0.511900</td>
<td>0.204500</td>
<td>0.121000</td> | 81_5_29 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | <tr>
<td>17</td>
<td>1.326800</td>
<td>1.407340</td>
<td>0.243400</td>
<td>0.511900</td>
<td>0.204500</td>
<td>0.121000</td>
<td>0.215700</td>
<td>0.468000</td>
<td>0.246200</td>
<td>0.394600</td>
<td>0.424200</td>
<td>0.225900</td>
<td>0.416100</td>
<td>0.705200</td>
<td>0.494900</td>
<td>0.638300</td>
<td>0.224900</td>
<td>0.430400</td>
<td>0.157200</td>
<td>0.317900</td>
<td>0.115700</td>
<td>0.369200</td>
<td>0.224200</td>
<td>0.365300</td>
</tr>
<tr>
<td>18</td>
<td>1.326800</td>
<td>1.419522</td> | 81_5_30 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | <td>0.369200</td>
<td>0.224200</td>
<td>0.365300</td>
</tr>
<tr>
<td>18</td>
<td>1.326800</td>
<td>1.419522</td>
<td>0.245100</td>
<td>0.521500</td>
<td>0.210000</td>
<td>0.116100</td>
<td>0.211500</td>
<td>0.489900</td>
<td>0.255400</td>
<td>0.391600</td>
<td>0.419700</td>
<td>0.198800</td>
<td>0.421200</td>
<td>0.701400</td>
<td>0.501800</td>
<td>0.634200</td>
<td>0.226700</td>
<td>0.410100</td>
<td>0.154400</td>
<td>0.321400</td>
<td>0.105900</td>
<td>0.352300</td>
<td>0.236700</td>
<td>0.380400</td> | 81_5_31 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | <td>0.410100</td>
<td>0.154400</td>
<td>0.321400</td>
<td>0.105900</td>
<td>0.352300</td>
<td>0.236700</td>
<td>0.380400</td>
</tr>
<tr>
<td>19</td>
<td>1.158600</td>
<td>1.398764</td>
<td>0.253600</td>
<td>0.519200</td>
<td>0.213600</td>
<td>0.135200</td>
<td>0.207700</td>
<td>0.491900</td>
<td>0.257300</td>
<td>0.397300</td>
<td>0.428000</td>
<td>0.241400</td>
<td>0.401800</td>
<td>0.703500</td>
<td>0.509700</td>
<td>0.631100</td>
<td>0.236700</td>
<td>0.441800</td>
<td>0.155900</td>
<td>0.330800</td> | 81_5_32 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | <td>0.703500</td>
<td>0.509700</td>
<td>0.631100</td>
<td>0.236700</td>
<td>0.441800</td>
<td>0.155900</td>
<td>0.330800</td>
<td>0.128100</td>
<td>0.352300</td>
<td>0.237500</td>
<td>0.384000</td>
</tr>
<tr>
<td>20</td>
<td>1.158600</td>
<td>1.390591</td>
<td>0.248800</td>
<td>0.520200</td>
<td>0.216600</td>
<td>0.127500</td>
<td>0.211400</td>
<td>0.471900</td>
<td>0.258300</td>
<td>0.407000</td>
<td>0.429100</td>
<td>0.240300</td>
<td>0.407600</td>
<td>0.708500</td>
<td>0.505800</td>
<td>0.623400</td> | 81_5_33 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | <td>0.407000</td>
<td>0.429100</td>
<td>0.240300</td>
<td>0.407600</td>
<td>0.708500</td>
<td>0.505800</td>
<td>0.623400</td>
<td>0.235500</td>
<td>0.431600</td>
<td>0.150000</td>
<td>0.325000</td>
<td>0.125700</td>
<td>0.375400</td>
<td>0.227200</td>
<td>0.390200</td>
</tr>
<tr>
<td>21</td>
<td>1.158600</td>
<td>1.360608</td>
<td>0.262700</td>
<td>0.544800</td>
<td>0.222100</td>
<td>0.134700</td>
<td>0.230000</td>
<td>0.487500</td>
<td>0.269500</td>
<td>0.413300</td>
<td>0.436300</td>
<td>0.236200</td> | 81_5_34 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | <td>0.134700</td>
<td>0.230000</td>
<td>0.487500</td>
<td>0.269500</td>
<td>0.413300</td>
<td>0.436300</td>
<td>0.236200</td>
<td>0.419100</td>
<td>0.709300</td>
<td>0.514100</td>
<td>0.637400</td>
<td>0.257200</td>
<td>0.450600</td>
<td>0.165100</td>
<td>0.338400</td>
<td>0.139400</td>
<td>0.372300</td>
<td>0.237700</td>
<td>0.382700</td>
</tr>
<tr>
<td>22</td>
<td>1.158600</td>
<td>1.368296</td>
<td>0.262800</td>
<td>0.542400</td>
<td>0.236400</td>
<td>0.137400</td>
<td>0.228100</td>
<td>0.498500</td> | 81_5_35 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | <td>1.368296</td>
<td>0.262800</td>
<td>0.542400</td>
<td>0.236400</td>
<td>0.137400</td>
<td>0.228100</td>
<td>0.498500</td>
<td>0.266500</td>
<td>0.409000</td>
<td>0.433000</td>
<td>0.239900</td>
<td>0.418500</td>
<td>0.697500</td>
<td>0.520500</td>
<td>0.641000</td>
<td>0.257500</td>
<td>0.455700</td>
<td>0.162600</td>
<td>0.334800</td>
<td>0.140200</td>
<td>0.353800</td>
<td>0.233200</td>
<td>0.379600</td>
</tr>
<tr>
<td>23</td>
<td>1.158600</td>
<td>1.368176</td>
<td>0.264800</td>
<td>0.541100</td> | 81_5_36 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | <td>0.379600</td>
</tr>
<tr>
<td>23</td>
<td>1.158600</td>
<td>1.368176</td>
<td>0.264800</td>
<td>0.541100</td>
<td>0.233100</td>
<td>0.138200</td>
<td>0.223900</td>
<td>0.498700</td>
<td>0.272300</td>
<td>0.407400</td>
<td>0.434400</td>
<td>0.233100</td>
<td>0.418300</td>
<td>0.702000</td>
<td>0.524400</td>
<td>0.642300</td>
<td>0.262300</td>
<td>0.444300</td>
<td>0.159700</td>
<td>0.335300</td>
<td>0.140500</td>
<td>0.366200</td>
<td>0.236900</td>
<td>0.384000</td>
</tr>
<tr>
<td>24</td> | 81_5_37 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | <td>0.335300</td>
<td>0.140500</td>
<td>0.366200</td>
<td>0.236900</td>
<td>0.384000</td>
</tr>
<tr>
<td>24</td>
<td>1.049700</td>
<td>1.355271</td>
<td>0.269700</td>
<td>0.549200</td>
<td>0.239100</td>
<td>0.134700</td>
<td>0.229900</td>
<td>0.519200</td>
<td>0.274800</td>
<td>0.412700</td>
<td>0.437600</td>
<td>0.245400</td>
<td>0.417200</td>
<td>0.711200</td>
<td>0.523200</td>
<td>0.644100</td>
<td>0.272100</td>
<td>0.440500</td>
<td>0.166700</td>
<td>0.341500</td>
<td>0.137700</td>
<td>0.373800</td> | 81_5_38 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | <td>0.644100</td>
<td>0.272100</td>
<td>0.440500</td>
<td>0.166700</td>
<td>0.341500</td>
<td>0.137700</td>
<td>0.373800</td>
<td>0.249000</td>
<td>0.388000</td>
</tr>
<tr>
<td>25</td>
<td>1.049700</td>
<td>1.355180</td>
<td>0.272500</td>
<td>0.547900</td>
<td>0.243800</td>
<td>0.149700</td>
<td>0.229900</td>
<td>0.523100</td>
<td>0.272500</td>
<td>0.415700</td>
<td>0.442200</td>
<td>0.256200</td>
<td>0.420200</td>
<td>0.705800</td>
<td>0.523900</td>
<td>0.639600</td>
<td>0.271700</td>
<td>0.451900</td> | 81_5_39 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | <td>0.256200</td>
<td>0.420200</td>
<td>0.705800</td>
<td>0.523900</td>
<td>0.639600</td>
<td>0.271700</td>
<td>0.451900</td>
<td>0.166300</td>
<td>0.346900</td>
<td>0.153700</td>
<td>0.383100</td>
<td>0.247000</td>
<td>0.389300</td>
</tr>
<tr>
<td>26</td>
<td>1.049700</td>
<td>1.349337</td>
<td>0.275600</td>
<td>0.556300</td>
<td>0.246400</td>
<td>0.146700</td>
<td>0.234800</td>
<td>0.516300</td>
<td>0.274200</td>
<td>0.418300</td>
<td>0.440900</td>
<td>0.248700</td>
<td>0.418900</td>
<td>0.705800</td> | 81_5_40 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | <td>0.516300</td>
<td>0.274200</td>
<td>0.418300</td>
<td>0.440900</td>
<td>0.248700</td>
<td>0.418900</td>
<td>0.705800</td>
<td>0.523200</td>
<td>0.636500</td>
<td>0.274700</td>
<td>0.440500</td>
<td>0.172400</td>
<td>0.349100</td>
<td>0.155600</td>
<td>0.384600</td>
<td>0.252300</td>
<td>0.393800</td>
</tr>
<tr>
<td>27</td>
<td>1.049700</td>
<td>1.350782</td>
<td>0.275200</td>
<td>0.548700</td>
<td>0.246800</td>
<td>0.147300</td>
<td>0.236400</td>
<td>0.527200</td>
<td>0.280100</td>
<td>0.416200</td> | 81_5_41 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | <td>0.548700</td>
<td>0.246800</td>
<td>0.147300</td>
<td>0.236400</td>
<td>0.527200</td>
<td>0.280100</td>
<td>0.416200</td>
<td>0.442600</td>
<td>0.253400</td>
<td>0.424000</td>
<td>0.710300</td>
<td>0.526600</td>
<td>0.640100</td>
<td>0.273200</td>
<td>0.445600</td>
<td>0.167000</td>
<td>0.346900</td>
<td>0.160100</td>
<td>0.387700</td>
<td>0.249200</td>
<td>0.392900</td>
</tr>
<tr>
<td>28</td>
<td>1.049700</td>
<td>1.346533</td>
<td>0.277000</td>
<td>0.552800</td>
<td>0.252900</td>
<td>0.147400</td> | 81_5_42 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | <tr>
<td>28</td>
<td>1.049700</td>
<td>1.346533</td>
<td>0.277000</td>
<td>0.552800</td>
<td>0.252900</td>
<td>0.147400</td>
<td>0.240000</td>
<td>0.527600</td>
<td>0.280900</td>
<td>0.420900</td>
<td>0.444100</td>
<td>0.255500</td>
<td>0.424500</td>
<td>0.711200</td>
<td>0.530200</td>
<td>0.646800</td>
<td>0.277400</td>
<td>0.441800</td>
<td>0.170900</td>
<td>0.346900</td>
<td>0.156600</td>
<td>0.389200</td>
<td>0.249600</td>
<td>0.396000</td>
</tr>
<tr>
<td>29</td>
<td>0.993700</td>
<td>1.346575</td> | 81_5_43 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | <td>0.389200</td>
<td>0.249600</td>
<td>0.396000</td>
</tr>
<tr>
<td>29</td>
<td>0.993700</td>
<td>1.346575</td>
<td>0.277100</td>
<td>0.554800</td>
<td>0.252900</td>
<td>0.148400</td>
<td>0.239700</td>
<td>0.523600</td>
<td>0.278400</td>
<td>0.420000</td>
<td>0.443300</td>
<td>0.256300</td>
<td>0.424000</td>
<td>0.705600</td>
<td>0.529600</td>
<td>0.647300</td>
<td>0.273900</td>
<td>0.439200</td>
<td>0.174300</td>
<td>0.348700</td>
<td>0.157600</td>
<td>0.386200</td>
<td>0.250100</td>
<td>0.395100</td> | 81_5_44 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | <td>0.439200</td>
<td>0.174300</td>
<td>0.348700</td>
<td>0.157600</td>
<td>0.386200</td>
<td>0.250100</td>
<td>0.395100</td>
</tr>
<tr>
<td>30</td>
<td>0.993700</td>
<td>1.346446</td>
<td>0.277400</td>
<td>0.554700</td>
<td>0.252700</td>
<td>0.147900</td>
<td>0.240800</td>
<td>0.523600</td>
<td>0.278800</td>
<td>0.420400</td>
<td>0.443300</td>
<td>0.256100</td>
<td>0.424200</td>
<td>0.705500</td>
<td>0.530100</td>
<td>0.646800</td>
<td>0.275600</td>
<td>0.440500</td>
<td>0.174500</td>
<td>0.348700</td> | 81_5_45 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | <td>0.705500</td>
<td>0.530100</td>
<td>0.646800</td>
<td>0.275600</td>
<td>0.440500</td>
<td>0.174500</td>
<td>0.348700</td>
<td>0.157300</td>
<td>0.386200</td>
<td>0.249200</td>
<td>0.394200</td>
</tr>
</tbody>
</table><p>
If you have set `push_to_hub` to `True` in the `training_args`, the training checkpoints are pushed to the
Hugging Face Hub. Upon training completion, push the final model to the Hub as well by calling the [`~transformers.Trainer.push_to_hub`] method.
```py | 81_5_46 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#training-the-detection-model | .md | ```py
>>> trainer.push_to_hub()
``` | 81_5_47 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#evaluate | .md | ```py
>>> from pprint import pprint | 81_6_0 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#evaluate | .md | >>> metrics = trainer.evaluate(eval_dataset=cppe5["test"], metric_key_prefix="test")
>>> pprint(metrics)
{'epoch': 30.0,
'test_loss': 1.0877351760864258,
'test_map': 0.4116,
'test_map_50': 0.741,
'test_map_75': 0.3663,
'test_map_Coverall': 0.5937,
'test_map_Face_Shield': 0.5863,
'test_map_Gloves': 0.3416,
'test_map_Goggles': 0.1468,
'test_map_Mask': 0.3894,
'test_map_large': 0.5637,
'test_map_medium': 0.3257,
'test_map_small': 0.3589,
'test_mar_1': 0.323,
'test_mar_10': 0.5237,
'test_mar_100': 0.5587, | 81_6_1 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#evaluate | .md | 'test_map_medium': 0.3257,
'test_map_small': 0.3589,
'test_mar_1': 0.323,
'test_mar_10': 0.5237,
'test_mar_100': 0.5587,
'test_mar_100_Coverall': 0.6756,
'test_mar_100_Face_Shield': 0.7294,
'test_mar_100_Gloves': 0.4721,
'test_mar_100_Goggles': 0.4125,
'test_mar_100_Mask': 0.5038,
'test_mar_large': 0.7283,
'test_mar_medium': 0.4901,
'test_mar_small': 0.4469,
'test_runtime': 1.6526,
'test_samples_per_second': 17.548,
'test_steps_per_second': 2.42}
``` | 81_6_2 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#evaluate | .md | 'test_mar_small': 0.4469,
'test_runtime': 1.6526,
'test_samples_per_second': 17.548,
'test_steps_per_second': 2.42}
```
These results can be further improved by adjusting the hyperparameters in [`TrainingArguments`]. Give it a go! | 81_6_3 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#inference | .md | Now that you have finetuned a model, evaluated it, and uploaded it to the Hugging Face Hub, you can use it for inference.
```py
>>> import torch
>>> import requests
>>> from PIL import Image, ImageDraw
>>> from transformers import AutoImageProcessor, AutoModelForObjectDetection | 81_7_0 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#inference | .md | >>> url = "https://images.pexels.com/photos/8413299/pexels-photo-8413299.jpeg?auto=compress&cs=tinysrgb&w=630&h=375&dpr=2"
>>> image = Image.open(requests.get(url, stream=True).raw)
```
Load model and image processor from the Hugging Face Hub (skip to use already trained in this session):
```py
>>> from accelerate.test_utils.testing import get_backend
# automatically detects the underlying device type (CUDA, CPU, XPU, MPS, etc.)
>>> device, _, _ = get_backend() | 81_7_1 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#inference | .md | # automatically detects the underlying device type (CUDA, CPU, XPU, MPS, etc.)
>>> device, _, _ = get_backend()
>>> model_repo = "qubvel-hf/detr_finetuned_cppe5" | 81_7_2 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#inference | .md | >>> image_processor = AutoImageProcessor.from_pretrained(model_repo)
>>> model = AutoModelForObjectDetection.from_pretrained(model_repo)
>>> model = model.to(device)
```
And detect bounding boxes:
```py | 81_7_3 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#inference | .md | >>> with torch.no_grad():
... inputs = image_processor(images=[image], return_tensors="pt")
... outputs = model(**inputs.to(device))
... target_sizes = torch.tensor([[image.size[1], image.size[0]]])
... results = image_processor.post_process_object_detection(outputs, threshold=0.3, target_sizes=target_sizes)[0] | 81_7_4 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#inference | .md | >>> for score, label, box in zip(results["scores"], results["labels"], results["boxes"]):
... box = [round(i, 2) for i in box.tolist()]
... print(
... f"Detected {model.config.id2label[label.item()]} with confidence "
... f"{round(score.item(), 3)} at location {box}"
... )
Detected Gloves with confidence 0.683 at location [244.58, 124.33, 300.35, 185.13]
Detected Mask with confidence 0.517 at location [143.73, 64.58, 219.57, 125.89] | 81_7_5 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#inference | .md | Detected Mask with confidence 0.517 at location [143.73, 64.58, 219.57, 125.89]
Detected Gloves with confidence 0.425 at location [179.15, 155.57, 262.4, 226.35]
Detected Coverall with confidence 0.407 at location [307.13, -1.18, 477.82, 318.06]
Detected Coverall with confidence 0.391 at location [68.61, 126.66, 309.03, 318.89]
```
Let's plot the result:
```py
>>> draw = ImageDraw.Draw(image) | 81_7_6 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/object_detection.md | https://huggingface.co/docs/transformers/en/tasks/object_detection/#inference | .md | >>> for score, label, box in zip(results["scores"], results["labels"], results["boxes"]):
... box = [round(i, 2) for i in box.tolist()]
... x, y, x2, y2 = tuple(box)
... draw.rectangle((x, y, x2, y2), outline="red", width=1)
... draw.text((x, y), model.config.id2label[label.item()], fill="white")
>>> image
```
<div class="flex justify-center">
<img src="https://i.imgur.com/oDUqD0K.png" alt="Object detection result on a new image"/>
</div> | 81_7_7 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/token_classification.md | https://huggingface.co/docs/transformers/en/tasks/token_classification/ | .md | <!--Copyright 2022 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | 82_0_0 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/token_classification.md | https://huggingface.co/docs/transformers/en/tasks/token_classification/ | .md | an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
⚠️ Note that this file is in Markdown but contain specific syntax for our doc-builder (similar to MDX) that may not be
rendered properly in your Markdown viewer.
--> | 82_0_1 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/token_classification.md | https://huggingface.co/docs/transformers/en/tasks/token_classification/#token-classification | .md | [[open-in-colab]]
<Youtube id="wVHdVlPScxA"/>
Token classification assigns a label to individual tokens in a sentence. One of the most common token classification tasks is Named Entity Recognition (NER). NER attempts to find a label for each entity in a sentence, such as a person, location, or organization.
This guide will show you how to: | 82_1_0 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/token_classification.md | https://huggingface.co/docs/transformers/en/tasks/token_classification/#token-classification | .md | This guide will show you how to:
1. Finetune [DistilBERT](https://huggingface.co/distilbert/distilbert-base-uncased) on the [WNUT 17](https://huggingface.co/datasets/wnut_17) dataset to detect new entities.
2. Use your finetuned model for inference.
<Tip>
To see all architectures and checkpoints compatible with this task, we recommend checking the [task-page](https://huggingface.co/tasks/token-classification).
</Tip>
Before you begin, make sure you have all the necessary libraries installed: | 82_1_1 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/token_classification.md | https://huggingface.co/docs/transformers/en/tasks/token_classification/#token-classification | .md | </Tip>
Before you begin, make sure you have all the necessary libraries installed:
```bash
pip install transformers datasets evaluate seqeval
```
We encourage you to login to your Hugging Face account so you can upload and share your model with the community. When prompted, enter your token to login:
```py
>>> from huggingface_hub import notebook_login | 82_1_2 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/token_classification.md | https://huggingface.co/docs/transformers/en/tasks/token_classification/#token-classification | .md | >>> notebook_login()
``` | 82_1_3 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/token_classification.md | https://huggingface.co/docs/transformers/en/tasks/token_classification/#load-wnut-17-dataset | .md | Start by loading the WNUT 17 dataset from the 🤗 Datasets library:
```py
>>> from datasets import load_dataset | 82_2_0 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/token_classification.md | https://huggingface.co/docs/transformers/en/tasks/token_classification/#load-wnut-17-dataset | .md | >>> wnut = load_dataset("wnut_17")
```
Then take a look at an example:
```py
>>> wnut["train"][0]
{'id': '0',
'ner_tags': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0],
'tokens': ['@paulwalk', 'It', "'s", 'the', 'view', 'from', 'where', 'I', "'m", 'living', 'for', 'two', 'weeks', '.', 'Empire', 'State', 'Building', '=', 'ESB', '.', 'Pretty', 'bad', 'storm', 'here', 'last', 'evening', '.']
}
``` | 82_2_1 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/token_classification.md | https://huggingface.co/docs/transformers/en/tasks/token_classification/#load-wnut-17-dataset | .md | }
```
Each number in `ner_tags` represents an entity. Convert the numbers to their label names to find out what the entities are:
```py
>>> label_list = wnut["train"].features[f"ner_tags"].feature.names
>>> label_list
[
"O",
"B-corporation",
"I-corporation",
"B-creative-work",
"I-creative-work",
"B-group",
"I-group",
"B-location",
"I-location",
"B-person",
"I-person",
"B-product",
"I-product",
]
```
The letter that prefixes each `ner_tag` indicates the token position of the entity: | 82_2_2 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/token_classification.md | https://huggingface.co/docs/transformers/en/tasks/token_classification/#load-wnut-17-dataset | .md | "B-product",
"I-product",
]
```
The letter that prefixes each `ner_tag` indicates the token position of the entity:
- `B-` indicates the beginning of an entity.
- `I-` indicates a token is contained inside the same entity (for example, the `State` token is a part of an entity like
`Empire State Building`).
- `0` indicates the token doesn't correspond to any entity. | 82_2_3 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/token_classification.md | https://huggingface.co/docs/transformers/en/tasks/token_classification/#preprocess | .md | <Youtube id="iY2AZYdZAr0"/>
The next step is to load a DistilBERT tokenizer to preprocess the `tokens` field:
```py
>>> from transformers import AutoTokenizer | 82_3_0 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/token_classification.md | https://huggingface.co/docs/transformers/en/tasks/token_classification/#preprocess | .md | >>> tokenizer = AutoTokenizer.from_pretrained("distilbert/distilbert-base-uncased")
```
As you saw in the example `tokens` field above, it looks like the input has already been tokenized. But the input actually hasn't been tokenized yet and you'll need to set `is_split_into_words=True` to tokenize the words into subwords. For example:
```py
>>> example = wnut["train"][0]
>>> tokenized_input = tokenizer(example["tokens"], is_split_into_words=True) | 82_3_1 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/token_classification.md | https://huggingface.co/docs/transformers/en/tasks/token_classification/#preprocess | .md | ```py
>>> example = wnut["train"][0]
>>> tokenized_input = tokenizer(example["tokens"], is_split_into_words=True)
>>> tokens = tokenizer.convert_ids_to_tokens(tokenized_input["input_ids"])
>>> tokens
['[CLS]', '@', 'paul', '##walk', 'it', "'", 's', 'the', 'view', 'from', 'where', 'i', "'", 'm', 'living', 'for', 'two', 'weeks', '.', 'empire', 'state', 'building', '=', 'es', '##b', '.', 'pretty', 'bad', 'storm', 'here', 'last', 'evening', '.', '[SEP]']
``` | 82_3_2 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/token_classification.md | https://huggingface.co/docs/transformers/en/tasks/token_classification/#preprocess | .md | ```
However, this adds some special tokens `[CLS]` and `[SEP]` and the subword tokenization creates a mismatch between the input and labels. A single word corresponding to a single label may now be split into two subwords. You'll need to realign the tokens and labels by:
1. Mapping all tokens to their corresponding word with the [`word_ids`](https://huggingface.co/docs/transformers/main_classes/tokenizer#transformers.BatchEncoding.word_ids) method. | 82_3_3 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/token_classification.md | https://huggingface.co/docs/transformers/en/tasks/token_classification/#preprocess | .md | 2. Assigning the label `-100` to the special tokens `[CLS]` and `[SEP]` so they're ignored by the PyTorch loss function (see [CrossEntropyLoss](https://pytorch.org/docs/stable/generated/torch.nn.CrossEntropyLoss.html)).
3. Only labeling the first token of a given word. Assign `-100` to other subtokens from the same word.
Here is how you can create a function to realign the tokens and labels, and truncate sequences to be no longer than DistilBERT's maximum input length:
```py | 82_3_4 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/token_classification.md | https://huggingface.co/docs/transformers/en/tasks/token_classification/#preprocess | .md | ```py
>>> def tokenize_and_align_labels(examples):
... tokenized_inputs = tokenizer(examples["tokens"], truncation=True, is_split_into_words=True) | 82_3_5 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/token_classification.md | https://huggingface.co/docs/transformers/en/tasks/token_classification/#preprocess | .md | ... labels = []
... for i, label in enumerate(examples[f"ner_tags"]):
... word_ids = tokenized_inputs.word_ids(batch_index=i) # Map tokens to their respective word.
... previous_word_idx = None
... label_ids = []
... for word_idx in word_ids: # Set the special tokens to -100.
... if word_idx is None:
... label_ids.append(-100)
... elif word_idx != previous_word_idx: # Only label the first token of a given word. | 82_3_6 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/token_classification.md | https://huggingface.co/docs/transformers/en/tasks/token_classification/#preprocess | .md | ... elif word_idx != previous_word_idx: # Only label the first token of a given word.
... label_ids.append(label[word_idx])
... else:
... label_ids.append(-100)
... previous_word_idx = word_idx
... labels.append(label_ids) | 82_3_7 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/token_classification.md | https://huggingface.co/docs/transformers/en/tasks/token_classification/#preprocess | .md | ... tokenized_inputs["labels"] = labels
... return tokenized_inputs
```
To apply the preprocessing function over the entire dataset, use 🤗 Datasets [`~datasets.Dataset.map`] function. You can speed up the `map` function by setting `batched=True` to process multiple elements of the dataset at once:
```py
>>> tokenized_wnut = wnut.map(tokenize_and_align_labels, batched=True)
``` | 82_3_8 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/token_classification.md | https://huggingface.co/docs/transformers/en/tasks/token_classification/#preprocess | .md | ```py
>>> tokenized_wnut = wnut.map(tokenize_and_align_labels, batched=True)
```
Now create a batch of examples using [`DataCollatorWithPadding`]. It's more efficient to *dynamically pad* the sentences to the longest length in a batch during collation, instead of padding the whole dataset to the maximum length.
<frameworkcontent>
<pt>
```py
>>> from transformers import DataCollatorForTokenClassification | 82_3_9 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/token_classification.md | https://huggingface.co/docs/transformers/en/tasks/token_classification/#preprocess | .md | >>> data_collator = DataCollatorForTokenClassification(tokenizer=tokenizer)
```
</pt>
<tf>
```py
>>> from transformers import DataCollatorForTokenClassification
>>> data_collator = DataCollatorForTokenClassification(tokenizer=tokenizer, return_tensors="tf")
```
</tf>
</frameworkcontent> | 82_3_10 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/token_classification.md | https://huggingface.co/docs/transformers/en/tasks/token_classification/#evaluate | .md | Including a metric during training is often helpful for evaluating your model's performance. You can quickly load a evaluation method with the 🤗 [Evaluate](https://huggingface.co/docs/evaluate/index) library. For this task, load the [seqeval](https://huggingface.co/spaces/evaluate-metric/seqeval) framework (see the 🤗 Evaluate [quick tour](https://huggingface.co/docs/evaluate/a_quick_tour) to learn more about how to load and compute a metric). Seqeval actually produces several scores: precision, recall, F1, | 82_4_0 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/token_classification.md | https://huggingface.co/docs/transformers/en/tasks/token_classification/#evaluate | .md | to learn more about how to load and compute a metric). Seqeval actually produces several scores: precision, recall, F1, and accuracy. | 82_4_1 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/token_classification.md | https://huggingface.co/docs/transformers/en/tasks/token_classification/#evaluate | .md | ```py
>>> import evaluate | 82_4_2 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/token_classification.md | https://huggingface.co/docs/transformers/en/tasks/token_classification/#evaluate | .md | >>> seqeval = evaluate.load("seqeval")
```
Get the NER labels first, and then create a function that passes your true predictions and true labels to [`~evaluate.EvaluationModule.compute`] to calculate the scores:
```py
>>> import numpy as np
>>> labels = [label_list[i] for i in example[f"ner_tags"]]
>>> def compute_metrics(p):
... predictions, labels = p
... predictions = np.argmax(predictions, axis=2) | 82_4_3 |
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/token_classification.md | https://huggingface.co/docs/transformers/en/tasks/token_classification/#evaluate | .md | >>> def compute_metrics(p):
... predictions, labels = p
... predictions = np.argmax(predictions, axis=2)
... true_predictions = [
... [label_list[p] for (p, l) in zip(prediction, label) if l != -100]
... for prediction, label in zip(predictions, labels)
... ]
... true_labels = [
... [label_list[l] for (p, l) in zip(prediction, label) if l != -100]
... for prediction, label in zip(predictions, labels)
... ] | 82_4_4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.