cvhub520 / yolov5_obb Goto Github PK
View Code? Open in Web Editor NEWLicense: GNU General Public License v3.0
License: GNU General Public License v3.0
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 大佬们遇到过吗?
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()
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.
哥,请问这个报错咋解决表情包
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)
是在训练时第一轮报错的
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.