sovit-123 / fasterrcnn-pytorch-training-pipeline

PyTorch Faster R-CNN Object Detection on Custom Dataset
MIT License
223 stars 75 forks source link

how tu use other model #144

Open merbenf opened 6 months ago

merbenf commented 6 months ago

114

hello sir when i'm trying to use the model fasterrcnn_efficientnet_b4 instead of the default one i'm getting an error at the begining i found that it is not mentioned on the create_fasterrcnn_model.py so i add it but when i'm runing the command like this it shows error !python train.py --model fasterrcnn_efficientnet_b4 --epochs 10 --data data_configs/custom_data.yaml how can i solve it ? ------- error ----------- !python train.py --model models/fasterrcnn_efficientnet_b4.py --data data_configs/custom_data.yaml fix this 2024-05-27 08:03:01.976187: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:9261] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered 2024-05-27 08:03:01.976243: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:607] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered 2024-05-27 08:03:02.076856: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1515] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered 2024-05-27 08:03:02.085446: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations. To enable the following instructions: AVX2 AVX512F FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags. 2024-05-27 08:03:03.152786: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT Not using distributed mode wandb: (1) Create a W&B account wandb: (2) Use an existing W&B account wandb: (3) Don't visualize my results wandb: Enter your choice: 3 wandb: You chose "Don't visualize my results" wandb: Tracking run with wandb version 0.17.0 wandb: W&B syncing is set to offline in this directory.
wandb: Run wandb online or set WANDB_MODE=online to enable cloud syncing. device cuda Checking Labels and images... 100% 573/573 [00:00<00:00, 136989.07it/s] Checking Labels and images... 100% 163/163 [00:00<00:00, 203473.68it/s] Creating data loaders /usr/local/lib/python3.10/dist-packages/torch/utils/data/dataloader.py:558: UserWarning: This DataLoader will create 4 worker processes in total. Our suggested max number of worker in current system is 2, which is smaller than what this DataLoader is going to create. Please be aware that excessive worker creation might get DataLoader running slow or even freeze, lower the worker number to avoid potential slowness/freeze if necessary. warnings.warn(_create_warning_msg( Number of training samples: 573 Number of validation samples: 163

Building model from scratch... Traceback (most recent call last): File "/content/fastercnn-pytorch-training-pipeline/train.py", line 571, in main(args) File "/content/fastercnn-pytorch-training-pipeline/train.py", line 305, in main build_model = create_model[args['model']] KeyError: 'models/fasterrcnn_efficientnet_b4.py' Traceback (most recent call last): File "/content/fastercnn-pytorch-training-pipeline/train.py", line 571, in main(args) File "/content/fastercnn-pytorch-training-pipeline/train.py", line 305, in main build_model = create_model[args['model']] KeyError: 'models/fasterrcnn_efficientnet_b4.py' wandb: You can sync this run to the cloud by running: wandb: wandb sync /content/fastercnn-pytorch-training-pipeline/wandb/offline-run-20240527_080317-2gkbw1tf wandb: Find logs at: ./wandb/offline-run-20240527_080317-2gkbw1tf/logs

sovit-123 commented 6 months ago

Will check it and reply here.

sovit-123 commented 6 months ago

Hello. After adding the function, please update the create_model dictionary in the create_fasterrcnn_model.py file. Add the following key-value pair.

'fasterrcnn_efficientnet_b4': return_fasterrcnn_efficientnet_b4

I hope that you have written the return_fasterrcnn_efficientnet_b4 function already.

merbenf commented 5 months ago

@sovit-123 i already did thank you so much sir i just wanna know how can i print the validation metrics like obj_loss and so on ?

sovit-123 commented 5 months ago

Hi. Validation loss is not included as of now as the loss is directly returned by the model. And the Torchvision detection models do no include the calculation of validation losses. Only validation mAP is possible.