Save predicted data as h5 file and metadata as pickle file; created by predict_videos.py.
(PredicteData, metadata, dataname, pdindex, imagenames, save_as_csv)
| 405 | |
| 406 | |
| 407 | def save_data(PredicteData, metadata, dataname, pdindex, imagenames, save_as_csv): |
| 408 | """Save predicted data as h5 file and metadata as pickle file; created by |
| 409 | predict_videos.py.""" |
| 410 | DataMachine = pd.DataFrame(PredicteData, columns=pdindex, index=imagenames) |
| 411 | if save_as_csv: |
| 412 | print("Saving csv poses!") |
| 413 | DataMachine.to_csv(dataname.split(".h5")[0] + ".csv") |
| 414 | DataMachine.to_hdf(dataname, key="df_with_missing", format="table", mode="w") |
| 415 | with open(dataname.split(".h5")[0] + "_meta.pickle", "wb") as f: |
| 416 | # Pickle the 'data' dictionary using the highest protocol available. |
| 417 | pickle.dump(metadata, f, pickle.HIGHEST_PROTOCOL) |
| 418 | |
| 419 | |
| 420 | def save_metadata(metadatafilename, data, trainIndices, testIndices, trainFraction): |