Detr: 2 cleanup items in plot_logs function (futureproof warning, crash if no log.txt exists)

Created on 1 Aug 2020  路  3Comments  路  Source: facebookresearch/detr

Instructions To Reproduce the 馃悰 Bug:

Upgraded my server to PyTorch 1.6 - begin receiving this error when using plot_logs:
'/home/ubuntu/detr/util/plot_utils.py:55: FutureWarning: The pandas.np module is deprecated and will be removed from pandas in a future version. Import numpy directly instead
pd.np.stack(df.test_coco_eval_bbox.dropna().values)[:, 1]'

and if I run plot_logs before a logs.txt has been written (b/c I'm very eager to check on progress :) then get a crash instead of an error informing me no log.txt is available yet.

  1. what changes you made (git diff) or what code you wrote
To future proof:
import numpy as np
remove pd from line 55 to become:
if field == 'mAP':
                coco_eval = pd.DataFrame(
                    **np.**stack(df.test_coco_eval_bbox.dropna().values)[:, 1]

2 - to handle no log file exists:
# check if first log file exists...it will not be present until after first log write
    fn = Path(logs[0]/log_name)

    if not fn.exists():
        print(f"-> missing {log_name} in first directory.  This is likely b/c you have not gotten to Epoch 1 in training.")
        print(f"--> file path: {fn}")
        return


  1. what exact command you run:
  2. what you observed (including __full logs__):
<put logs here>
  1. please simplify the steps as much as possible so they do not require additional resources to
    run, such as a private dataset.

Expected behavior:

If there are no obvious error in "what you observed" provided above,
please tell us the expected behavior.

Environment:

Provide your environment information using the following command:

python -m torch.utils.collect_env

All 3 comments

Can you send a PR with the proposed fixes?

Yes happy to, thanks for the feedback.

Merged in #194 thanks @lessw2020 !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mli0603 picture mli0603  路  5Comments

dvd42 picture dvd42  路  7Comments

tomek-l picture tomek-l  路  4Comments

woctezuma picture woctezuma  路  5Comments

rardz picture rardz  路  5Comments