def download_annotations(self, results):
        """Download the annotations from the CVAT server for the given results
        instance and parses them into the appropriate FiftyOne types.

        Args:
            results: a :class:`CVATAnnotationResults`

        Returns:
            the annotations dict
        """
        label_schema = results.config.label_schema
        occluded_attr = results.config.occluded_attr
        group_id_attr = results.config.group_id_attr
        id_map = results.id_map
        server_id_map = results.server_id_map
        task_ids = results.task_ids
        frame_id_map = results.frame_id_map
        labels_task_map = results.labels_task_map
        is_clips = results._is_clips

        _, project_id = self._parse_project_details(
            results.config.project_name, results.config.project_id
        )

        if results.project_ids:
            # This task created the project, so we know that `label_schema` is
            # already complete and we don't need `project_id` to help us here
            project_id = None

        (
            _,
            assigned_scalar_attrs,
            occluded_attrs,
            group_id_attrs,
            label_field_classes,
        ) = self._get_cvat_schema(
            label_schema,
            project_id=project_id,
            occluded_attr=occluded_attr,
            group_id_attr=group_id_attr,
        )

        labels_task_map_rev = defaultdict(list)
        for lf, tasks in labels_task_map.items():
            for task in tasks:
                labels_task_map_rev[task].append(lf)

        annotations = {}
        deleted_tasks = []

        pb_kwargs = {"total": len(task_ids), "iters_str": "tasks"}
        if len(task_ids) == 1:
            pb_kwargs["quiet"] = True

        with fou.ProgressBar(**pb_kwargs) as pb:
            for task_id in pb(task_ids):
                if not self.task_exists(task_id):
                    deleted_tasks.append(task_id)
                    logger.warning(
                        "Skipping task %d, which no longer exists", task_id
                    )
                    continue

                data_resp = self.get(self.task_data_meta_url(task_id)).json()
                frames = data_resp["frames"]
                frame_start = data_resp["start_frame"]
                frame_stop = data_resp["stop_frame"]
                frame_step = _parse_frame_step(data_resp)

                if is_clips:
                    offset = results.id_map["_clips_frame_start"][task_id]
                    frame_start -= offset
                    frame_stop -= offset

                # Download task data
                attr_id_map, _class_map_rev = self._get_attr_class_maps(
                    task_id
                )

                job_ids = self._get_job_ids(task_id)
                for job_id in job_ids:
                    job_resp = self.get(self.job_annotation_url(job_id)).json()
                    all_shapes = job_resp["shapes"]
                    all_tags = job_resp["tags"]
                    all_tracks = job_resp["tracks"]

                    # For videos that were subsampled, remap the frame numbers
                    # to those on the original video
                    all_shapes = _remap_annotation_frames(
                        all_shapes, frame_start, frame_stop, frame_step
                    )
                    all_tags = _remap_annotation_frames(
                        all_tags, frame_start, frame_stop, frame_step
                    )
                    all_tracks = _remap_annotation_frames(
                        all_tracks, frame_start, frame_stop, frame_step
                    )

                    label_fields = labels_task_map_rev[task_id]
                    label_types = self._get_return_label_types(
                        label_schema, label_fields
                    )

                    for lf_ind, label_field in enumerate(label_fields):
                        label_info = label_schema[label_field]
                        label_type = label_info.get("type", None)
                        scalar_attrs = assigned_scalar_attrs.get(
                            label_field, False
                        )
                        _occluded_attrs = occluded_attrs.get(label_field, {})
                        _group_id_attrs = group_id_attrs.get(label_field, {})
                        _id_map = id_map.get(label_field, {})

                        label_field_results = {}

                        # Dict mapping class labels to the classes used in
                        # CVAT. These are equal unless a class appears in
                        # multiple fields
                        _classes = label_field_classes[label_field]

                        # Maps CVAT IDs to FiftyOne labels
                        class_map = {
                            _class_map_rev[name_lf]: name
                            for name, name_lf in _classes.items()
                        }

                        _cvat_classes = class_map.keys()
                        tags, shapes, tracks = self._filter_field_classes(
                            all_tags,
                            all_shapes,
                            all_tracks,
                            _cvat_classes,
                        )

                        is_last_field = lf_ind == len(label_fields) - 1
                        ignore_types = self._get_ignored_types(
                            project_id, label_types, label_type, is_last_field
                        )

                        tag_results = self._parse_shapes_tags(
                            "tags",
                            tags,
                            frame_id_map[task_id],
                            label_type,
                            _id_map,
                            server_id_map.get("tags", {}),
                            class_map,
                            attr_id_map,
                            frames,
                            ignore_types,
                            frame_stop,
                            frame_step,
                            assigned_scalar_attrs=scalar_attrs,
                        )
                        label_field_results = self._merge_results(
                            label_field_results, tag_results
                        )

                        shape_results = self._parse_shapes_tags(
                            "shapes",
                            shapes,
                            frame_id_map[task_id],
                            label_type,
                            _id_map,
                            server_id_map.get("shapes", {}),
                            class_map,
                            attr_id_map,
                            frames,
                            ignore_types,
                            frame_stop,
                            frame_step,
                            assigned_scalar_attrs=scalar_attrs,
                            occluded_attrs=_occluded_attrs,
                            group_id_attrs=_group_id_attrs,
                        )
                        label_field_results = self._merge_results(
                            label_field_results, shape_results
                        )

                        for track_index, track in enumerate(tracks, 1):
                            label_id = track["label_id"]
                            shapes = track["shapes"]
                            track_group_id = track.get("group", None)
                            for shape in shapes:
                                shape["label_id"] = label_id

                            immutable_attrs = track["attributes"]

                            track_shape_results = self._parse_shapes_tags(
                                "track",
                                shapes,
                                frame_id_map[task_id],
                                label_type,
                                _id_map,
                                server_id_map.get("tracks", {}),
                                class_map,
                                attr_id_map,
                                frames,
                                ignore_types,
                                frame_stop,
                                frame_step,
                                assigned_scalar_attrs=scalar_attrs,
                                track_index=track_index,
                                track_group_id=track_group_id,
                                immutable_attrs=immutable_attrs,
                                occluded_attrs=_occluded_attrs,
                                group_id_attrs=_group_id_attrs,
                            )
                            label_field_results = self._merge_results(
                                label_field_results, track_shape_results
                            )

                        frames_metadata = {}
                        for cvat_frame_id, frame_data in frame_id_map[
                            task_id
                        ].items():
                            sample_id = frame_data["sample_id"]
                            if "frame_id" in frame_data and len(frames) == 1:
                                frames_metadata[sample_id] = frames[0]
                                break

                            if len(frames) > cvat_frame_id:
                                frame_metadata = frames[cvat_frame_id]
                            else:
                                frame_metadata = None

                            frames_metadata[sample_id] = frame_metadata

                        # Polyline(s) corresponding to instance/semantic masks
                        # need to be converted to their final format
                        self._convert_polylines_to_masks(
                            label_field_results, label_info, frames_metadata
                        )

                        annotations = self._merge_results(
                            annotations, {label_field: label_field_results}
                        )

        if deleted_tasks:
            results._forget_tasks(deleted_tasks)

        return annotations
Download the annotations from the CVAT server for the given results
        instance and parses them into the appropriate FiftyOne types.

        Args:
            results: a :class:`CVATAnnotationResults`

        Returns:
            the annotations dict
        
fiftyone/utils/cvat.py