Skip to content

Commit

Permalink
fix: remove cvat filename prefixing (#3823)
Browse files Browse the repository at this point in the history
keeping old behavior for cvat versions < 2.4.6 because
of cvat bug fix cvat-ai/cvat#5083

Change-Id: I542695437c05c09bb48023d598af479965abb384
  • Loading branch information
hoshimura authored Nov 28, 2023
1 parent 1f54423 commit 260378a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions fiftyone/utils/cvat.py
Original file line number Diff line number Diff line change
Expand Up @@ -4233,6 +4233,9 @@ def upload_data(

files, open_files = self._parse_local_files(paths)

if self._server_version >= Version("2.4.6"):
data["sorting_method"] = "predefined"

try:
self.post(self.task_data_url(task_id), data=data, files=files)
except Exception as e:
Expand Down Expand Up @@ -4294,10 +4297,12 @@ def _parse_local_files(self, paths):
else:
# Image task
for idx, path in enumerate(paths):
# IMPORTANT: CVAT organizes media within a task alphabetically
# by filename, so we must give CVAT filenames whose
# alphabetical order matches the order of `paths`
filename = "%06d_%s" % (idx, os.path.basename(path))
filename = os.path.basename(path)
if self._server_version < Version("2.4.6"):
# IMPORTANT: older versions of CVAT organizes media within
# a task alphabetically by filename, so we must give CVAT
# filenames whose alphabetical order matches the order of `paths`
filename = "%06d_%s" % (idx, os.path.basename(path))

if self._server_version >= Version("2.3"):
with open(path, "rb") as f:
Expand Down

0 comments on commit 260378a

Please sign in to comment.