Closed kkashore closed 10 months ago
Hi @kkashore,
Sorry, this was an oversight on my part. Basically what's happening is the plot_losses_and_lr()
function isn't properly accounting for a training run where there is no validation set. For the time being, you can comment out the below line of code in BaseTrainer.py
to prevent this error when not using a validation set:
I will put up a PR to fix this sometime within the next hour or two.
This will be fixed once PR #217 is merged.
This should be resolved now once you fetch the latest changes from this repo / sync your fork of this repo.
Let us know if you run into any other bugs or have any questions!
Dear @yahskapar,
Thank you very much for your prompt reply!
python main.py --config_file ./configs/train_configs/PURE_PURE_UBFC-rPPG_TSCAN_BASIC.yaml When I encounter an error while running the above command, how should I resolve it? ====Training Epoch: 29==== Train epoch 29: 77%|██████████▋ | 99/129 [00:20<00:05, 5.06it/s, loss=0.466][29, 100] loss: 0.684 Train epoch 29: 100%|█████████████| 129/129 [00:26<00:00, 4.92it/s, loss=0.337] Saved Model Path: runs/exp/firsttrain/PreTrainedModels/PURE_PURE_UBFC_tscan_Epoch29.pth Traceback (most recent call last): File "main.py", line 291, in
train_and_test(config, data_loader_dict)
File "main.py", line 80, in train_and_test
model_trainer.train(data_loader_dict)
File "/media/imcm/Data/kangyx/rPPG_Toolbox_main/neural_methods/trainer/TscanTrainer.py", line 113, in train
self.plot_losses_and_lrs(mean_training_losses, mean_valid_losses, lrs, self.config)
File "/media/imcm/Data/kangyx/rPPG_Toolbox_main/neural_methods/trainer/BaseTrainer.py", line 72, in plot_losses_and_lrs
plt.plot(epochs, valid_loss, label='Validation Loss')
File "/home/imcm/anaconda3/envs/rppg-toolbox/lib/python3.8/site-packages/matplotlib/pyplot.py", line 2787, in plot
return gca().plot(
File "/home/imcm/anaconda3/envs/rppg-toolbox/lib/python3.8/site-packages/matplotlib/axes/_axes.py", line 1665, in plot
lines = [self._get_lines(args, data=data, **kwargs)]
File "/home/imcm/anaconda3/envs/rppg-toolbox/lib/python3.8/site-packages/matplotlib/axes/_base.py", line 225, in call
yield from self._plot_args(this, kwargs)
File "/home/imcm/anaconda3/envs/rppg-toolbox/lib/python3.8/site-packages/matplotlib/axes/_base.py", line 391, in _plot_args
x, y = self._xy_from_xy(x, y)
File "/home/imcm/anaconda3/envs/rppg-toolbox/lib/python3.8/site-packages/matplotlib/axes/_base.py", line 269, in _xy_from_xy
raise ValueError("x and y must have same first dimension, but "
ValueError: x and y must have same first dimension, but have shapes (30,) and (0,)