roboflow / notebooks

Examples and tutorials on using SOTA computer vision models and techniques. Learn everything from old-school ResNet, through YOLO and object-detection transformers like DETR, to the latest models like Grounding DINO and SAM.
https://roboflow.com/models
4.89k stars 759 forks source link

in train-huggingface-detr-on-custom-dataset.ipynb how to do detewction on image and video #139

Closed VYRION-Ai closed 1 year ago

VYRION-Ai commented 1 year ago

Search before asking

Description

i do traing using https://colab.research.google.com/github/roboflow-ai/notebooks/blob/main/notebooks/train-huggingface-detr-on-custom-dataset.ipynb#scrollTo=A6YfGgeATvbR and i got two files pytorch_model.bin and epoch=6-step=308.ckpt , and close the colab sesion , i need to do detection now, what should i do and how ? please help @SkalskiP @ca

Additional

No response

Are you willing to submit a PR?

github-actions[bot] commented 1 year ago

👋 Hello @VYRION-Ai, thank you for leaving an issue on Roboflow Notebooks.

🐞 Bug reports

If you are filing a bug report, please be as detailed as possible. This will help us more easily diagnose and resolve the problem you are facing. To learn more about contributing, check out our Contributing Guidelines.

If you require support with custom code that is not part of Roboflow Notebooks, please reach out on the Roboflow Forum or on the GitHub Discussions page associated with this repository.

💬 Get in touch

Do you have more questions about Roboflow that we haven't responded to yet? Feel free to ask them on the Roboflow Discuss forum. Our developer advocates and community team actively respond to questions there.

To ask questions about Notebooks, head over to the GitHub Discussions section of this repository.

SkalskiP commented 1 year ago

Hi, @VYRION-Ai 👋🏻 ! How did you save your model? In our notebook, we proposed a saving model like this:

MODEL_PATH = os.path.join(HOME, 'custom-model')
model.model.save_pretrained(MODEL_PATH)

That should allow you to load model like this:

model = DetrForObjectDetection.from_pretrained(MODEL_PATH)
model.to(DEVICE)
VYRION-Ai commented 1 year ago

@SkalskiP thank you very much it works with me now.

SkalskiP commented 1 year ago

@VYRION-Ai this is awesome to hear!