Open chethanluffy opened 2 years ago
Hello, do you know what the content in the output file (results_ex-chunk.pkl) means now, and how to view the performance of the model on the dataset, such as Rank1@0.5, Rank5@0.5 etc. Thanks!
add these lines inplace of for loop in "tools/test.py" to get output predictions as CSV file. You will understand the output once you open the CSV file.
resultsDf = pd.DataFrame() #### Writing RESULTS to CSV
csvPath = args.out
csvPath = csvPath.replace('.pkl','.csv')
for i, data in enumerate(data_loader):
fileName = data['video_metas'][0]._data[0][0]['ori_video_name']
nFrames = data['video_metas'][0]._data[0][0]['ori_tsize']
print("FileName: ", fileName)
with torch.no_grad():
result = engine(data)[0]
#### Writing RESULTS to CSV
for classID, eaclClassResult in enumerate(result):
tempDf = pd.DataFrame(eaclClassResult, columns = ['sFrame','eFrame','classScore'])
tempDf['nFrames'] = nFrames
tempDf['class'] = classID
tempDf['file'] = fileName
if classID == 0 and i == 0:
resultsDf = tempDf.copy()
resultsDf.to_csv(csvPath, index=False) #### Writing RESULTS to CSV
else:
resultsDf = pd.concat([tempDf, resultsDf], ignore_index=True)
resultsDf.to_csv(csvPath, index=False) #### Writing RESULTS to CSV
print(resultsDf.shape)
#### Writing RESULTS to CSV
results.append(result)
batch_size = len(data["video_metas"][0].data)
for _ in range(batch_size):
prog_bar.update()
print("CSV file saved @ : ", csvPath)
resultsDf.to_csv(csvPath, index=False) #### Writing RESULTS to CSV
Thank you very much, I will try it.
Thank you for you excellent work! I have a question regarding the output data format. Could you kindly explain the output data format which is being saved as pickle file at the end of the Inference(tools/test.py). And is there script to visualize Inference output? Thanks