sovit-123 / fasterrcnn-pytorch-training-pipeline

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

Now only can save last epoch weight? I mean this (last_model_state.pth) #12

Closed MheadHero closed 2 years ago

MheadHero commented 2 years ago

And actually how to use this last_model_state.pth, like what info can I get from it?

MheadHero commented 2 years ago

And why so less amount of the valid_images?

sovit-123 commented 2 years ago

And actually how to use this last_model_state.pth, like what info can I get from it?

You can use it for inference on images and videos as you may find in inference.py and inference_video.py. You can also use it to resume training. The following is an example command: python train.py --config data_configs/smoke.yaml --epochs 100 --model fasterrcnn_resnet50 --project-name smoke_training --batch-size 16 --weights outputs/training/res_1/last_model_state.pth

And why so less amount of the valid_images?

Right now, the code saves the validation images from a single batch only for each epoch. So, it will save the number of images as per the batch size. If the batch size is 2, it will save 2 images, if 4, it will save 4 images, and so on.

MheadHero commented 2 years ago

Noted with many thanks. And why don't make it save the best epoch and last epoch?

sovit-123 commented 2 years ago

Noted with many thanks. And why don't make it save the best epoch and last epoch?

Sure. Working in that and many more features. Also, please close this issue if this answers your question for now.

HAMZA12337 commented 1 year ago

please i want to ask you i get empty folder when i execute python inference.py --input test/arm-bone-fracture-x-ray12_jpg.rf.45d20b0a3f8539272e34d23c069a0c14.jpg --weights outputs/training/smoke_training/last_model_state.pth
Building from model name arguments... Test instances: 1 Image 1 done...

TEST PREDICTIONS COMPLETE Average FPS: 0.412

sovit-123 commented 1 year ago

The results will be located in outputs/inference/res_# directory. Please let me know if you cannot find it.

HAMZA12337 commented 1 year ago

outputs/inference/res# i have this directory but inside res# is empty no images found

sovit-123 commented 1 year ago

Can you name your inference image and try running the inference again? Maybe the image naming is causing some issues to get the proper name of the image. Let me know if the issue persists.