Git Product home page Git Product logo

yolov5_obb's People

Contributors

cvhub520 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

yolov5_obb's Issues

c++ 部署时遇到这个问题

OpenCV(4.6.0) Error: Assertion failed (total(srcShape, srcRange.start, srcRange.end) == maskTotal) in cv::dnn::computeShapeByReshapeMask, file c:\build\master_winpack-build-win64-vc15\opencv\modules\dnn\src\layers\reshape_layer.cpp, line 108 大佬们遇到过吗?

onnxruntime 部署部分为什么是将角度作为类回归,这样我测试了没有原本模型检测准确度

def preprocess(self, img, new_shape):
    img = self.letterbox(img, new_shape, auto=False)[0]
    img = img.transpose((2, 0, 1))[::-1]  # HWC to CHW, BGR to RGB
    img = np.ascontiguousarray(img).astype('float32')
    img /= 255  # 0 - 255 to 0.0 - 1.0
    if len(img.shape) == 3:
        img = img[None]  # expand for batch dim
    return img

def postprecess(self, prediction, src_img, new_shape):

    nc = prediction.shape[2] - 5 - 180  # number of classes

    xc = prediction[..., 4] > CONF_THRES
    outputs = prediction[:][xc]

    generate_boxes, bboxes, scores = [], [], []

    for out in outputs:

        cx, cy, longside, shortside, obj_score = out[:5]
        class_scores = out[5: 5+nc]
        class_idx = np.argmax(class_scores)

        max_class_score = class_scores[class_idx] * obj_score
        if max_class_score < CONF_THRES:
            continue

        theta_scores = out[5+nc:]
        theta_idx = np.argmax(theta_scores)
        theta_pred = (theta_idx - 90) / 180 * PI

        bboxes.append([[cx, cy], [longside, shortside], max_class_score])
        scores.append(max_class_score)
        generate_boxes.append([
            cx, cy, longside, shortside, 
            theta_pred, max_class_score, class_idx
        ])

    indices = cv2.dnn.NMSBoxesRotated(
        bboxes, scores, CONF_THRES, NMS_THRES
    )
    det = np.array(generate_boxes)[indices.flatten()]

    pred_poly = self.rbox2poly(det[:, :5])

    pred_poly = self.scale_polys(new_shape, pred_poly, src_img.shape)
    det = np.concatenate((pred_poly, det[:, -2:]), axis=1) # (n, [poly conf cls])

    for *poly, conf, cls in reversed(det):
        c = int(cls)
        label = f'{CLASSES[c]} {conf:.2f}'
        self.poly_label(src_img, poly, label, COLORS[c])
    
    cv2.imshow('Result', src_img)
    cv2.waitKey(0)
    cv2.destroyAllWindows()

Matching PyTorch and Cuda versions

Trying to run your project on Google Colab. Your "install torch 1.12.0+cu116" line gives me an error:
RuntimeError:
The detected CUDA version (12.2) mismatches the version that was used to compile
PyTorch (11.6). Please make sure to use the same CUDA versions.

This seems to be an error I have gotten before on other projects. The Colab environment is updated at some point, and the combo's of software don't match the cuda available.

indices should be either on cpu or on the same device as the indexed tensor (cpu)

哥,请问这个报错咋解决表情包
Traceback (most recent call last):
File "D:\CHENGXUKU\yolov5_obb\train.py", line 633, in
main(opt)
File "D:\CHENGXUKU\yolov5_obb\train.py", line 530, in main
train(opt.hyp, opt, device, callbacks)
File "D:\CHENGXUKU\yolov5_obb\train.py", line 373, in train
compute_loss=compute_loss)
File "D:\anaconda\envs\yolo\lib\site-packages\torch\autograd\grad_mode.py", line 27, in decorate_context
return func(*args, *kwargs)
File "D:\CHENGXUKU\yolov5_obb\val.py", line 206, in run
out = non_max_suppression_obb(out, conf_thres, iou_thres, labels=lb, multi_label=True, agnostic=single_cls) # list
(n, [xylsθ, conf, cls]) θ ∈ [-pi/2, pi/2)
File "D:\CHENGXUKU\yolov5_obb\utils\general.py", line 854, in non_max_suppression_obb
_, i = obb_nms(rboxes, scores, iou_thres)
File "D:\CHENGXUKU\yolov5_obb\utils\nms_rotated\nms_rotated_wrapper.py", line 37, in obb_nms
ori_inds = ori_inds[~too_small]
RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cpu)
是在训练时第一轮报错的

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.