-
Notifications
You must be signed in to change notification settings - Fork 0
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
rocAL Tensor Video pipeline changes #19
rocAL Tensor Video pipeline changes #19
Conversation
fiona-gladwin
commented
Apr 6, 2023
- Change instances of image to tensor
- Add changes to VideoFileSource, VideoFileResize and SequenceReader API
- Remove video loader module and structures associated with it.
- Make use of Loader module for video pipeline.
- Remove VideoDecoderConfig, VideoReaderConfig, VideoStorageType and VideoDecoderType
- Modify Sequence Rearrange wrt tensor.
- Fix the brightness and CMN augmentations to operate on sequences
Change instances of image to tensor Remove video loader module Remove VideoDecoderConfig, VideoReaderConfig Remove VideoStorageType and VideoDecoderType
Code clean up
All loader API call in master graph
Add sequence batch size variable to change the batch size based on sequence length
vxReleaseImage(&image); | ||
|
||
// Check for input parameters | ||
vx_tensor input; |
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.
looks like input is not initialized here. Please use the parameter corresponding to input and output
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.
Done
return ERRMSG(VX_ERROR_INVALID_DIMENSION, "validate: SequenceRearrange: tensor: #0 dimensions=%lu (must be greater than or equal to 4)\n", in_num_tensor_dims); | ||
|
||
// Check for output parameters | ||
vx_tensor output; |
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.
output is not initialized
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.
Done
STATUS_ERROR_CHECK(vxSetMetaFormatAttribute(metas[1], VX_TENSOR_DIMS, &tensor_dims, sizeof(tensor_dims))); | ||
STATUS_ERROR_CHECK(vxSetMetaFormatAttribute(metas[1], VX_TENSOR_DATA_TYPE, &tensor_type, sizeof(tensor_type))); | ||
STATUS_ERROR_CHECK(vxSetMetaFormatAttribute(metas[1], VX_TENSOR_FIXED_POINT_POSITION, &tensor_fixed_point_position, sizeof(tensor_fixed_point_position))); | ||
vxReleaseTensor(&input); |
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 not release tensor here. Just reference it for querying. See samples in amd_nn extensions for proper usage
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.
Done
STATUS_ERROR_CHECK(vxSetMetaFormatAttribute(metas[1], VX_TENSOR_FIXED_POINT_POSITION, &tensor_fixed_point_position, sizeof(tensor_fixed_point_position))); | ||
vxReleaseTensor(&input); | ||
vxReleaseTensor(&output); | ||
vxReleaseParameter(&input_param); |
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.
Not required to release parameters and tensors
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.
Done
SequenceRearrangeLocalData *data; | ||
STATUS_ERROR_CHECK(vxQueryNode(node, VX_NODE_LOCAL_DATA_PTR, &data, sizeof(data))); | ||
STATUS_ERROR_CHECK(releaseGraphHandle(node, data->handle, data->deviceType)); | ||
free(data->newOrder); |
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.
please check the data validity before freeing
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.
Done
std::shared_ptr<SequenceRearrangeNode> sequence_rearrange_node = context->master_graph->add_node<SequenceRearrangeNode>({input}, {output}); | ||
sequence_rearrange_node->init(new_order, new_sequence_length, sequence_length, context->master_graph->internal_batch_size()); | ||
sequence_rearrange_node->init(new_order); |
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.
why is the sequence_length and new_sequence_length not needed anymore?
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.
Previously we did not have the provision to store sequence length in ImageInfo
Now we can get the sequence length and new sequence length directly from the dims of input tensor and the new order vector length respectively.
info.set_color_format(color_format); | ||
info.set_tensor_layout(RocalTensorlayout::NFHWC); | ||
info.set_sequence_batch_size(sequence_length); | ||
info.set_max_shape(); |
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.
what does set_max_shape() api do here?
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.
Set max shape is to store the max width and height of the tensor wrt the layout passed.
It is set only only for the dataloaders i.e the first node.
{ | ||
Image* output = nullptr; | ||
unsigned stride) { | ||
rocalTensor* output = nullptr; |
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.
please move this after the context validity check
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.
We are checking if the context is set and we throw the error and return the rocalTensor
Hence the output rocalTensor is initialized to nullptr before the validity check
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.
@fiona-gladwin : please address review comments
Move SequenceInfo back to video reader Null ptr check Variable name change
Hi @rrawther I have addressed all review comments. Please check |
@fiona-gladwin : Please merge tot changes before making next PR |