-
Notifications
You must be signed in to change notification settings - Fork 67
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
Conversation
…)]] to represent each batch rather than returning Dict[ndarray: (batch, frames, coords)].
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor clerical questions.
armory/datasets/preprocessing.py
Outdated
# 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 | ||
|
There was a problem hiding this comment.
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?
armory/datasets/preprocessing.py
Outdated
# 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 | ||
|
There was a problem hiding this comment.
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.
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") |
There was a problem hiding this comment.
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.
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) |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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.
… 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)].
Replaced by #1836 |
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.