-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Retrain with new images #7
Comments
It's hard to diagnose this without the data you're using, but dimension 0 should be the channel dimension. Could you please check, how many dimensions your images have? They might be binary, but still have 3 dimensions (i.e. be RGB images). |
Do you mean whether they are 1 bit or 8 bit or 24 bit? |
Right now, the full images are 8 bit grayscale and the mask images are 1 bit B/W |
Please post the complete error stack that you receive. |
My methodology
Am I missing something in these steps? Here is the complete error stack:IndexError Traceback (most recent call last) File ~/micromamba/envs/paddle/lib/python3.8/site-packages/hydra/main.py:33, in main..main_decorator..decorated_main(cfg_passthrough) File ~/micromamba/envs/paddle/lib/python3.8/site-packages/hydra/_internal/utils.py:364, in _run_hydra(args_parser, task_function, config_path, config_name, strict) File ~/micromamba/envs/paddle/lib/python3.8/site-packages/hydra/_internal/utils.py:215, in run_and_report(func) File ~/micromamba/envs/paddle/lib/python3.8/site-packages/hydra/_internal/utils.py:212, in run_and_report(func) File ~/micromamba/envs/paddle/lib/python3.8/site-packages/hydra/_internal/utils.py:365, in _run_hydra..() File ~/micromamba/envs/paddle/lib/python3.8/site-packages/hydra/_internal/hydra.py:109, in Hydra.run(self, config_name, task_function, overrides, with_log_configuration) File ~/micromamba/envs/paddle/lib/python3.8/site-packages/hydra/core/utils.py:129, in run_job(config, task_function, job_dir_key, job_subdir_key, configure_logging) File ~/Desktop/paddle/paddle/training.py:70, in train_mask_rcnn(config) File ~/micromamba/envs/paddle/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py:510, in Trainer.fit(self, model, train_dataloader, val_dataloaders, datamodule) File ~/micromamba/envs/paddle/lib/python3.8/site-packages/pytorch_lightning/accelerators/accelerator.py:57, in Accelerator.train(self) File ~/micromamba/envs/paddle/lib/python3.8/site-packages/pytorch_lightning/accelerators/accelerator.py:74, in Accelerator.train_or_test(self) File ~/micromamba/envs/paddle/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py:532, in Trainer.train(self) File ~/micromamba/envs/paddle/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py:731, in Trainer.run_sanity_check(self, ref_model) File ~/micromamba/envs/paddle/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py:644, in Trainer.run_evaluation(self, max_batches, on_epoch) File ~/micromamba/envs/paddle/lib/python3.8/site-packages/pytorch_lightning/trainer/evaluation_loop.py:191, in EvaluationLoop.evaluation_step_end(self, *args, **kwargs) File ~/micromamba/envs/paddle/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py:933, in Trainer.call_hook(self, hook_name, *args, **kwargs) File ~/Desktop/paddle/paddle/lightning_modules.py:167, in LightningMaskRCNN.validation_step_end(self, output) File ~/micromamba/envs/paddle/lib/python3.8/site-packages/torch/nn/modules/module.py:727, in Module._call_impl(self, *input, **kwargs) File ~/micromamba/envs/paddle/lib/python3.8/site-packages/pytorch_lightning/metrics/metric.py:154, in Metric.forward(self, *args, **kwargs) File ~/micromamba/envs/paddle/lib/python3.8/site-packages/pytorch_lightning/metrics/metric.py:200, in Metric._wrap_update..wrapped_func(*args, **kwargs) File ~/Desktop/paddle/paddle/metrics/confusion_matrix.py:67, in ConfusionMatrix.update(self, predictions, targets) File ~/Desktop/paddle/paddle/metrics/confusion_matrix.py:139, in ConfusionMatrix._evaluate_image(self, prediction, target) IndexError: index 2 is out of bounds for dimension 0 with size 2 |
Thanks for posting the stack. I think that helped a lot... Forget what I said about the image format.
This is during the evaluation, where the code tries to compute the confusion matrix, for the different classes. The error says that the confusion matrix was initialized with 2 classes. This is the default value. The first class is the background class (0) and the second class is the particle class (1). However, your ground truth data has more than two classes. The number of classes in the ground truth data, is defined as the number of subfolders (e.g. "particle"). Do you happen to have more than one subfolder in your "train2" and/or "valid2" folder? |
While we're at it: Unfortunately, I cannot provide too much support for paddle any longer, since the respective project ended. Fortunately, there has been a lot of progress in the meantime, with regard to the usability of Mask R-CNN for custom applications. Therefore, I'd recommend making a switch to the mmdetection framework, which has a large community and therefore a much more detailed documentation. |
This is a good place to get started: https://mmdetection.readthedocs.io/en/latest/user_guides/train.html#train-with-customized-datasets I understand, if you don't want to make the switch right away, since you might already be close to getting paddle to run properly. So I can still try to help you, to sort this issue out. However, if you encounter further problems, I'd definitely advise making the switch. |
Thanks for the help, we were able to get it working. |
Great! Then please give a short explanation, what caused the problem, in case that others have the same issue. 👍 |
How can I correctly upload images to retrain the model? The new mask images are binary 1 bit images, and they are all the same dimensions as the original training images, but when I try to use my new training/validation in the training demo, I get an index error saying: IndexError: index 2 is out of bounds for dimension 0 with size 2.
I have followed the structure for the image file paths and names, so I don't know why I am getting this error.
The text was updated successfully, but these errors were encountered: