垂钓检测模型

我要开发同款
匿名用户2024年07月31日
49阅读

技术信息

开源地址
https://modelscope.cn/models/copperfield/cv_tinynas_fishing-dectection_damoyalo
授权协议
Apache License 2.0

作品详情

该模型当前使用的是默认介绍模版,处于“预发布”阶段,页面仅限所有者可见。
请根据模型贡献文档说明,及时完善模型卡片内容。ModelScope平台将在模型卡片完善后展示。谢谢您的理解。

Cloe with HTTP

 git cloe https://www.modelscope.c/copperfield/cv_tiyas_fishig-dectectio_damoyalo.git

推理代码

from modelscope.pipelies import pipelie
from modelscope.utils.costat import Tasks
import cv2
import umpy as p
import os

# Iitialize the object detectio pipelie
object_detect = pipelie(Tasks.image_object_detectio, model='copperfield/cv_tiyas_fishig-dectectio_damoyalo')

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

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

# Process each image i the iput directory
for fileame i os.listdir(iput_dir):
    if fileame.lower().edswith(('.pg', '.jpg', '.jpeg')):
        img_path = os.path.joi(iput_dir, fileame)

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

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

        # Draw boudig boxes ad labels
        for i i rage(le(boxes)):
            box = boxes[i]
            label = labels[i]
            score = scores[i]

            # Extract boudig box coordiates
            x_mi, y_mi, x_max, y_max = box.astype(p.it32)

            # Draw the boudig box
            cv2.rectagle(image, (x_mi, y_mi), (x_max, y_max), (0, 255, 0), 2)

            # Label ad cofidece
            label_text = f'{label}: {score:.2f}'
            cv2.putText(image, label_text, (x_mi, y_mi - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.9, (0, 255, 0), 2)

        # Save the processed image
        output_img_path = os.path.joi(output_dir, fileame)
        cv2.imwrite(output_img_path, image)

功能介绍

该模型当前使用的是默认介绍模版,处于“预发布”阶段,页面仅限所有者可见。 请根据模型贡献文档说明,及时完善模型卡片内容。ModelScope平台将在模型卡片完善后展示。谢谢您的理解。 Clone wi

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论