Reading HDF5 feature files with classes containing only single features#38
Reading HDF5 feature files with classes containing only single features#38RRabinow wants to merge 1 commit into
Conversation
…ly a single feature
| image_names = None | ||
| features = torch.cat(temp, dim=1) | ||
| if len(temp[0].shape) == 1: | ||
| temp[0] = temp[0][None,:] |
There was a problem hiding this comment.
@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.
There was a problem hiding this comment.
@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.
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.