Skip to content

Commit

Permalink
[Datumaro] Remote project export fixes (#1193)
Browse files Browse the repository at this point in the history
* Export project with trask name

* Do not expose server paths

* Fix tfrecord mask reading in tf>1.14

* Setuptools compatibility
  • Loading branch information
zhiltsov-max authored Feb 26, 2020
1 parent cd8ef2a commit f2dfcc0
Show file tree
Hide file tree
Showing 10 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,12 @@ def __init__(self, url):
items = []
for entry in image_list:
item_id = entry['id']
item_filename = entry.get('name', str(item_id))
size = None
if entry.get('height') and entry.get('width'):
size = (entry['height'], entry['width'])
image = Image(data=self._make_image_loader(item_id), size=size)
image = Image(data=self._make_image_loader(item_id),
path=item_filename, size=size)
item = datumaro.DatasetItem(id=item_id, image=image)
items.append((item.id, item))

Expand Down
4 changes: 3 additions & 1 deletion cvat/apps/dataset_manager/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ def _load(self):
CvatImagesDirExtractor)

def _import_from_task(self, user):
self._project = Project.generate(self._project_dir)
self._project = Project.generate(self._project_dir,
config={'project_name': self._db_task.name})

self._project.add_source('task_%s_images' % self._db_task.id, {
'url': self._db_task.get_data_dirname(),
Expand Down Expand Up @@ -185,6 +186,7 @@ def _remote_image_converter(self, save_dir, server_url=None):
for db_image in self._db_task.image_set.all():
frame_info = {
'id': db_image.frame,
'name': osp.basename(db_image.path),
'width': db_image.width,
'height': db_image.height,
}
Expand Down
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ def _parse_tfrecord_file(cls, filepath, subset_name, images_dir):
parsed_record['image/object/class/text'],
default_value=b'').numpy()
masks = tf.sparse.to_dense(
parsed_record['image/object/mask']).numpy()
parsed_record['image/object/mask'],
default_value=b'').numpy()

for label, label_id in zip(labels, label_ids):
label = label.decode('utf-8')
Expand Down
Empty file.
Empty file.

0 comments on commit f2dfcc0

Please sign in to comment.