---
title: cv_tinynas_fishing-dectection_damoyalo
canonical_url: "https://www.modelscope.cn/models/copperfield/cv_tinynas_fishing-dectection_damoyalo"
md_url: "https://www.modelscope.cn/models/copperfield/cv_tinynas_fishing-dectection_damoyalo.md"
repository: copperfield/cv_tinynas_fishing-dectection_damoyalo
chinese_name: "垂钓检测模型"
last_updated: 2024-01-03
license: "Apache License 2.0"
pipeline_tag: domain-specific-object-detection
tasks:
  - domain-specific-object-detection
library_name:
  - pytorch
frameworks:
  - Pytorch
downloads: 2887
stars: 3
---

# cv_tinynas_fishing-dectection_damoyalo

> cv_tinynas_fishing-dectection_damoyalo - copperfield 在 ModelScope 开源的模型。用于检测水边垂钓行为

copperfield/cv_tinynas_fishing-dectection_damoyalo 是 ModelScope 魔搭社区上的domain-specific-object-detection模型，采用 Apache License 2.0 许可。

- **Repository**: copperfield/cv_tinynas_fishing-dectection_damoyalo
- **License**: Apache License 2.0
- **Tasks**: domain-specific-object-detection
- **Downloads**: 2887
- **Stars**: 3
- **Last updated**: 2024-01-03

Source: https://www.modelscope.cn/models/copperfield/cv_tinynas_fishing-dectection_damoyalo

---

###### 该模型当前使用的是默认介绍模版，处于“预发布”阶段，页面仅限所有者可见。
###### 请根据[模型贡献文档说明](https://www.modelscope.cn/docs/%E5%A6%82%E4%BD%95%E6%92%B0%E5%86%99%E5%A5%BD%E7%94%A8%E7%9A%84%E6%A8%A1%E5%9E%8B%E5%8D%A1%E7%89%87)，及时完善模型卡片内容。ModelScope平台将在模型卡片完善后展示。谢谢您的理解。
#### Clone with HTTP
```bash
 git clone https://www.modelscope.cn/copperfield/cv_tinynas_fishing-dectection_damoyalo.git
```

推理代码

```
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks
import cv2
import numpy as np
import os

# Initialize the object detection pipeline
object_detect = pipeline(Tasks.image_object_detection, model='copperfield/cv_tinynas_fishing-dectection_damoyalo')

# Directory paths
input_dir = './test'
output_dir = './test_res'

# Create the output directory if it doesn't exist
if not os.path.exists(output_dir):
    os.makedirs(output_dir)

# Process each image in the input directory
for filename in os.listdir(input_dir):
    if filename.lower().endswith(('.png', '.jpg', '.jpeg')):
        img_path = os.path.join(input_dir, filename)

        # Perform object detection
        result = object_detect(img_path)
        image = cv2.imread(img_path)

        # Parse detection results
        scores = result['scores']
        labels = result['labels']
        boxes = result['boxes']

        # Draw bounding boxes and labels
        for i in range(len(boxes)):
            box = boxes[i]
            label = labels[i]
            score = scores[i]

            # Extract bounding box coordinates
            x_min, y_min, x_max, y_max = box.astype(np.int32)

            # Draw the bounding box
            cv2.rectangle(image, (x_min, y_min), (x_max, y_max), (0, 255, 0), 2)

            # Label and confidence
            label_text = f'{label}: {score:.2f}'
            cv2.putText(image, label_text, (x_min, y_min - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.9, (0, 255, 0), 2)

        # Save the processed image
        output_img_path = os.path.join(output_dir, filename)
        cv2.imwrite(output_img_path, image)
```
