If you are using pandas to read the csv file, you might use pd.DataFrame.loc 1 to write to the desired image ID.
Since pandas uses numpy arrays internally, you could access the array via tensor.numpy().
I’m not sure, if you are also asking about the PyTorch code to extract the features, so let me know, if you need more information.