Code Monkey home page Code Monkey logo

Comments (9)

yangxue0827 avatar yangxue0827 commented on July 17, 2024

具体例子呢?

from retinanet_tensorflow_rotation.

622tongtong avatar 622tongtong commented on July 17, 2024

def iou_rotate_calculate1(boxes1, boxes2, use_gpu=True, gpu_id=0):

# start = time.time()

if use_gpu:
    ious = rbbx_overlaps(boxes1, boxes2, gpu_id)
else:
    area1 = boxes1[:, 2] * boxes1[:, 3]
    area2 = boxes2[:, 2] * boxes2[:, 3]
    ious = []
    for i, box1 in enumerate(boxes1):
        temp_ious = []
        r1 = ((box1[0], box1[1]), (box1[2], box1[3]), box1[4])
        for j, box2 in enumerate(boxes2):
            r2 = ((box2[0], box2[1]), (box2[2], box2[3]), box2[4])

            int_pts = cv2.rotatedRectangleIntersection(r1, r2)[1]
            if int_pts is not None:
                order_pts = cv2.convexHull(int_pts, returnPoints=True)

                int_area = cv2.contourArea(order_pts)

                inter = int_area * 1.0 / (area1[i] + area2[j] - int_area)
                temp_ious.append(inter)
            else:
                temp_ious.append(0.0)
        ious.append(temp_ious)

# print('{}s'.format(time.time() - start))

return np.array(ious, dtype=np.float32)

这个函数,利用gpu,或者不用,输入的都是边界框的5参数模式,用gpu计算出的结果存在大于1的,gpu=False的结果都在1以内

from retinanet_tensorflow_rotation.

yangxue0827 avatar yangxue0827 commented on July 17, 2024

你得给我一个具体的例子。

from retinanet_tensorflow_rotation.

622tongtong avatar 622tongtong commented on July 17, 2024

具体的例子,是源代码吗?

from retinanet_tensorflow_rotation.

yangxue0827 avatar yangxue0827 commented on July 17, 2024

哪两个框算出来大于1。代码我自己能不清楚吗。

from retinanet_tensorflow_rotation.

622tongtong avatar 622tongtong commented on July 17, 2024

target:[ 0.00000, 0.00000, 1.32031, 0.22607, -51.36830]
prediction:[ 0.00000, 0.00000, 1.40039, 1.19531, -82.40114]
gpu算出来: 2.21053

from retinanet_tensorflow_rotation.

yangxue0827 avatar yangxue0827 commented on July 17, 2024

那是因为边太小造成的数值问题,你可以加一个判断,边太小的iou直接是0。

from retinanet_tensorflow_rotation.

yangxue0827 avatar yangxue0827 commented on July 17, 2024

一般框的长宽不会这么小,尤其不会小于1

from retinanet_tensorflow_rotation.

622tongtong avatar 622tongtong commented on July 17, 2024

哦哦,搜嘎,谢谢你哟~

from retinanet_tensorflow_rotation.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.