# How to use the trained model and test it on another dataset?

**URL:** <https://discuss.roboflow.com/t/how-to-use-the-trained-model-and-test-it-on-another-dataset/464>\
**Category:** 🤝  Community Help\
**Created:** [May 18, 2022, 10:04pm UTC](https://discuss.roboflow.com/t/how-to-use-the-trained-model-and-test-it-on-another-dataset/464 "2022-05-18T22:04:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Diego\_Abade](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/diego_abade/32/317_2.png) [@Diego\_Abade](https://discuss.roboflow.com/u/Diego_Abade)\
**Post date:** [May 18, 2022, 10:04pm UTC](https://discuss.roboflow.com/t/how-to-use-the-trained-model-and-test-it-on-another-dataset/464/1 "2022-05-18T22:04:11Z")

</div>

I have trained a YOLOv5 model and would like to test it for detection on another database, I trained it using the RoboFlow source code.

I would like to know how I can get this model and test it somewhere else, is there any ready-made code that I can do this?

---

<div class="post-metadata">

**Author:** ![Mohamed](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/mohamed/32/62_2.png) [@Mohamed](https://discuss.roboflow.com/u/Mohamed)\
**Post date:** [May 18, 2022, 10:38pm UTC](https://discuss.roboflow.com/t/how-to-use-the-trained-model-and-test-it-on-another-dataset/464/2 "2022-05-18T22:38:32Z")

</div>

Hi Diego,

For your custom model, if you have [saved the model weights](https://blog.roboflow.com/how-to-save-and-load-weights-in-google-colab/), then you can use detect.py from YOLOv5 to run inference - just remember to clone the repository to your local machine. Here’s an example guide on running inference with your webcam:

- [Run YOLOv5 on Your Webcam - Roboflow](https://help.roboflow.com/en_US/guides/run-yolov5-on-your-webcam)

There are more options available on the repository, outlined in the [Documentation](https://github.com/ultralytics/yolov5#documentation) and the [detect.py source code](https://github.com/ultralytics/yolov5/blob/master/detect.py).

 ![image](https://canada1.discourse-cdn.com/flex029/uploads/roboflow1/original/1X/8c5fb31bf35fa59a03f2651e328b75fd5c80312b.png)

Additionally, here are our resources to help with performing inference using models trained with [Roboflow Train](https://docs.roboflow.com/train):

> **[Inference - Object Detection](https://docs.roboflow.com/inference)**
>
> Leverage your custom trained model for cloud-hosted inference or edge deployment.

- [Response object format](https://docs.roboflow.com/inference/hosted-api#response-object-format) (the results you receive from your model when running inference)
- [Code Snippets for the Inference API (object detection)](https://docs.roboflow.com/inference/hosted-api#code-snippets)
- [Code Snippets for the Inference API (classification)](https://docs.roboflow.com/inference-classification/hosted-api#code-snippets)
- [Obtaining Your API Key](https://docs.roboflow.com/rest-api#obtaining-your-api-key)
- [Infer with the Roboflow Python package or Upload API (Example Code included)](https://colab.research.google.com/drive/1BceQZAP90SnjkfWSFX5xdrZP_9scmOAO?usp=sharing)

---

<div class="post-metadata">

**Author:** ![Diego\_Abade](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/diego_abade/32/317_2.png) [@Diego\_Abade](https://discuss.roboflow.com/u/Diego_Abade)\
**Post date:** [May 19, 2022, 3:17pm UTC](https://discuss.roboflow.com/t/how-to-use-the-trained-model-and-test-it-on-another-dataset/464/3 "2022-05-19T15:17:27Z")

</div>

Thank you!
