# How to count class when I detect tumor from endoscopy dataset?

**URL:** <https://discuss.roboflow.com/t/how-to-count-class-when-i-detect-tumor-from-endoscopy-dataset/1205>\
**Category:** 🤝  Community Help\
**Tags:** bugs, feature-request\
**Created:** [December 23, 2022, 9:13am UTC](https://discuss.roboflow.com/t/how-to-count-class-when-i-detect-tumor-from-endoscopy-dataset/1205 "2022-12-23T09:13:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Md\_Sagar\_Hossen](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/md_sagar_hossen/32/983_2.png) [@Md\_Sagar\_Hossen](https://discuss.roboflow.com/u/Md_Sagar_Hossen)\
**Post date:** [December 23, 2022, 9:13am UTC](https://discuss.roboflow.com/t/how-to-count-class-when-i-detect-tumor-from-endoscopy-dataset/1205/1 "2022-12-23T09:13:57Z")

</div>

I created a project that classifies and predict tumour from an endoscopy video. I trained with an annotation of the point with the tumour, and I tested with video. it is successfully run with the yolo5v algorithm. But now I want to count how many tumours detect in that video. Can anyone help me to count that?  
Thanks in advance.

---

<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:** [December 23, 2022, 3:08pm UTC](https://discuss.roboflow.com/t/how-to-count-class-when-i-detect-tumor-from-endoscopy-dataset/1205/2 "2022-12-23T15:08:57Z")

</div>

Hi, here’s an object counting script that works with [Roboflow’s prediction response format](https://docs.roboflow.com/inference/hosted-api#response-object-format):

- [roboflow-computer-vision-utilities/object\_counting.py at main · roboflow/roboflow-computer-vision-utilities · GitHub](https://github.com/roboflow/roboflow-computer-vision-utilities/blob/main/object_counting.py)

The counting function portion of the script can be adapted to work with detect.py from your YOLOv5 predictions.

- [yolov5/detect.py at master · ultralytics/yolov5 · GitHub](https://github.com/ultralytics/yolov5/blob/master/detect.py) (processing of results begins after line 137)

---

<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:** [December 23, 2022, 3:25pm UTC](https://discuss.roboflow.com/t/how-to-count-class-when-i-detect-tumor-from-endoscopy-dataset/1205/3 "2022-12-23T15:25:46Z")

</div>

In addition, to track _specific_ tumors across video frames, for example, you’ll need to implement object tracking.

We also have a GitHub repository for object tracking to help get you started: [GitHub - roboflow/zero-shot-object-tracking: Object tracking implemented with the Roboflow Inference API, DeepSort, and OpenAI CLIP.](https://github.com/roboflow/zero-shot-object-tracking)

---

<div class="post-metadata">

**Author:** ![Md\_Sagar\_Hossen](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/md_sagar_hossen/32/983_2.png) [@Md\_Sagar\_Hossen](https://discuss.roboflow.com/u/Md_Sagar_Hossen)\
**Post date:** [December 23, 2022, 3:27pm UTC](https://discuss.roboflow.com/t/how-to-count-class-when-i-detect-tumor-from-endoscopy-dataset/1205/4 "2022-12-23T15:27:10Z")

</div>

Thank you sir
