Skip to content

Conversation

@RRabinow
Copy link
Contributor

@RRabinow RRabinow commented Nov 2, 2021

This pull request adds support to readHDF5.py - read_features() method, enabling the parsing of HDF5 feature files when some classes have only one sample. In the current state of vast, this use case causes a crash.

image_names = None
features = torch.cat(temp, dim=1)
if len(temp[0].shape) == 1:
temp[0] = temp[0][None,:]
Copy link
Member

Choose a reason for hiding this comment

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

@RRabinow Thanks for pointing this out and proposing a fix.
Looks like you are only checking and fixing for the zeroth index of the temp list, but there is no guarantee that the temp list will always have a length of 1 since in line 55 temp is being appended in a for loop. If your test cases were only using one feature file, yes your fix will work but it will break the case where features from multiple files need to be concatenated.
So the solution would be either to run your check and fix in a for loop running for all elements of temp or a better alternative would be to store the value being appended into temp at line 55 in a temporary variable, then perform your check and fix on that variable, which will then will be appended into the temp list.
Let me know if this makes sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@akshay-raj-dhamija I did not consider multiple feature files being read. I will adjust the code to apply the fix on line 55 instead. Thank you.

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