Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TFDSv4 carla_video_tracking upgrade. #1829

Closed
wants to merge 46 commits into from

Conversation

jprokos26
Copy link
Contributor

@jprokos26 jprokos26 commented Dec 20, 2022

Throws an error when run without flags but completes successfully with --skip-attack. See #1814 for more information.

Status:

  • carla_video_tracking_dev
  • carla_video_tracking

Both uploaded to s3 and ready for review.

@jprokos26 jprokos26 changed the title (WIP) TFDSv4 carla_video_tracking upgrade. TFDSv4 carla_video_tracking upgrade. Dec 20, 2022
Copy link
Contributor Author

@jprokos26 jprokos26 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor clerical questions.

Comment on lines 233 to 246
# if batch.dtype == np.object:
# for x in batch:
# check_shapes(x.shape, context.x_shape)
# assert x.dtype == context.input_type
# assert x.min() >= context.input_min
# assert x.max() <= context.input_max

# quantized_batch = np.zeros_like(batch, dtype=np.object)
# for i in range(len(batch)):
# quantized_batch[i] = (
# batch[i].astype(context.output_type) / context.quantization
# )
# batch = quantized_batch

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the preprocessor handle pure python objects as done here?

Comment on lines 257 to 264
# assert tf.math.reduce_min(batch) >= context.input_min
# assert tf.math.reduce_max(batch) <= context.input_max

# for x in batch:
# assert x.dtype == context.output_type
# assert tf.math.reduce_min(x) >= context.output_min
# assert tf.math.reduce_max(x) <= context.output_max

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is now passed into the dataloader as a function instead of operating on the actual tensor, should this still check the min & max values? TF was complaining about assert statements, but I can look for another way to implement this logic.

Comment on lines +172 to +179
class EvalGenerator:
"""
Wraps a specified number of batches in a DataGenerator to allow for evaluating on
part of a dataset when running through a scenario
"""

def __init__(self, armory_generator, num_eval_batches):
raise NotImplementedError("EvalGenerator not implemented")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added to satisfy import statement in another file I had not changed; should this be implemented or removed? I can find where the specific site where this needed to be imported if it is helpful.

Comment on lines +241 to +278
class ClipFrames:
"""
Clip Video Frames
Assumes first two dims are (batch, frames, ...)
"""

def __init__(self, max_frames):
max_frames = int(max_frames)
if max_frames <= 0:
raise ValueError(f"max_frames {max_frames} must be > 0")
self.max_frames = max_frames

def __call__(self, batch):
return batch[:, : self.max_frames]


class ClipVideoTrackingLabels:
"""
Truncate labels for CARLA video tracking, when max_frames is set
"""

def __init__(self, max_frames):
max_frames = int(max_frames)
if max_frames <= 0:
raise ValueError(f"max_frames {max_frames} must be > 0")
self.max_frames = max_frames

def clip_boxes(self, boxes):
return boxes[:, : self.max_frames, :]

def clip_metadata(self, patch_metadata_dict):
return {
k: v[:, : self.max_frames, ::] for (k, v) in patch_metadata_dict.items()
}

def __call__(self, x, labels):
boxes, patch_metadata_dict = labels
return self.clip_boxes(boxes), self.clip_metadata(patch_metadata_dict)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these classes belong here or elsewhere?



@register
def carla_video_tracking_dev(element, max_frames=None):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am assuming max_frames gets passed in as a dataset_kwargs but this is untested as I cannot find an example of it being used previously.

davidslater and others added 19 commits December 21, 2022 20:35
… much about keeping track of module name, function name and how it registers within armory to global variable 'supported', a MetricNameSpace, and how it is passed as input to GlobalMeter/Meter creation in MetricsLogger
* update ci tests

* combine dockerfiles

* update image map

* remove carla from `build.py`

* fix issue 1787

* remove `tf2` container

* remove `deepspeech`

* update documentation
…)]] to represent each batch rather than returning Dict[ndarray: (batch, frames, coords)].
@jprokos26
Copy link
Contributor Author

Replaced by #1836

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants