Git Product home page Git Product logo

yolodet-pytorch's People

Contributors

wuzhihao7788 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  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  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yolodet-pytorch's Issues

使用yolov4_coco_100e的cfg训练网络,计算map过程特别慢

您好,非常感谢您能够提供这么好的yolo框架。但是我在使用yolov4_coco_100e的cfg文集训练时,计算map的过程特别慢,计算一次map要花费6分钟的时间。我使用的batch_size=8,subdivisions=4,使用的数据集共2500张,测试集有600张,gpu是1080的。我在u版的yolo上使用yolov4训练我的数据相同的设置计算map只需要30秒的时间,请问这里面是哪里出了问题?

mixup增广怎么用

请问mixup增广在没加进去,我直接用,精度下降;把mixup的分数加到qfl的weight上好像也没提升

Tuple Error when Data Loading

Traceback (most recent call last):
  File "tools/train.py", line 144, in <module>
    main()
  File "tools/train.py", line 140, in main
    train_detector(model,datasets,cfg,validate=args.validate,timestamp=timestamp,meta=meta)
  File "/home/wenchi/projects/yolodet-pytorch-2/yolodet/apis/train.py", line 161, in train_detector
    runner.run(data_loaders, cfg.workflow, cfg.total_epochs)
  File "/home/wenchi/projects/yolodet-pytorch-2/yolodet/apis/runner.py", line 331, in run
    epoch_runner(data_loaders[i], **kwargs)
  File "/home/wenchi/projects/yolodet-pytorch-2/yolodet/apis/runner.py", line 214, in train
    for i, data_batch in enumerate(data_loader):
  File "/home/wenchi/miniconda3/envs/yolodet-2/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 521, in __next__
    data = self._next_data()
  File "/home/wenchi/miniconda3/envs/yolodet-2/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1203, in _next_data
    return self._process_data(data)
  File "/home/wenchi/miniconda3/envs/yolodet-2/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1229, in _process_data
    data.reraise()
  File "/home/wenchi/miniconda3/envs/yolodet-2/lib/python3.7/site-packages/torch/_utils.py", line 425, in reraise
    raise self.exc_type(msg)
TypeError: Caught TypeError in DataLoader worker process 0.
Original Traceback (most recent call last):
  File "/home/wenchi/miniconda3/envs/yolodet-2/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 287, in _worker_loop
    data = fetcher.fetch(index)
  File "/home/wenchi/miniconda3/envs/yolodet-2/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/home/wenchi/miniconda3/envs/yolodet-2/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/home/wenchi/projects/yolodet-pytorch-2/yolodet/dataset/custom.py", line 112, in __getitem__
    data = self.prepare_train_img(idx)
  File "/home/wenchi/projects/yolodet-pytorch-2/yolodet/dataset/custom.py", line 106, in prepare_train_img
    return self.pipeline(results)
  File "/home/wenchi/projects/yolodet-pytorch-2/yolodet/dataset/pipelines/compose.py", line 47, in __call__
    data = t(data)
  File "/home/wenchi/projects/yolodet-pytorch-2/yolodet/dataset/pipelines/transforms.py", line 139, in __call__
    hsv[1] *= dsat
TypeError: 'tuple' object does not support item assignment

Hey guys, when I try to run the model on both COCO and my own custom dataset, I ran into the above error. I am sure that the annotation format is correct. Do you have some idea how to fix it?

One more thing that I am not clear is the label.names. Could you show me the format of the label.names? Could the above error caused by the label.names when doing data loading?

Thank you very much!

Wenchi

yolov5 model struct bug.

感谢开源此项目!
yolov5项目模型结构有问题

  • backbone中CSP_2_1是属于Neck部分
  • Neck多输出了一个data,但是在Head中又去除了那个data.

没有仔细看你的代码构建,就算最终结果没问题,但是代码可读性变差了

训练两个epoch之后依然报错,希望得到大家的帮助

train words:python tools/train.py --work_dir results cfg/yolov5_coco_100e.py --device 0 --validate

Traceback (most recent call last):
File "tools/train.py", line 144, in
main()
File "tools/train.py", line 140, in main
train_detector(model,datasets,cfg,validate=args.validate,timestamp=timestamp,meta=meta)
File "/home/tongyu/develop-project/yolodet-pytorch-master/yolodet/apis/train.py", line 161, in train_detector
runner.run(data_loaders, cfg.workflow, cfg.total_epochs)
File "/home/tongyu/develop-project/yolodet-pytorch-master/yolodet/apis/runner.py", line 331, in run
epoch_runner(data_loaders[i], **kwargs)
File "/home/tongyu/develop-project/yolodet-pytorch-master/yolodet/apis/runner.py", line 230, in train
self.call_hook('after_train_epoch')
File "/home/tongyu/develop-project/yolodet-pytorch-master/yolodet/apis/runner.py", line 205, in call_hook
getattr(hook, fn_name)(self)
File "/home/tongyu/develop-project/yolodet-pytorch-master/yolodet/models/hooks/eval_hook.py", line 52, in after_train_epoch
results = single_gpu_test(model, self.dataloader)
File "/home/tongyu/develop-project/yolodet-pytorch-master/yolodet/apis/test.py", line 93, in single_gpu_test
output = non_max_suppression(inf_out, conf_thres=conf_thres, iou_thres=iou_thres, merge=merge)
File "/home/tongyu/develop-project/yolodet-pytorch-master/yolodet/models/heads/base.py", line 355, in non_max_suppression
i = torchvision.ops.boxes.nms(boxes, scores, iou_thres)
File "/home/tongyu/.conda/envs/yolodet/lib/python3.6/site-packages/torchvision/ops/boxes.py", line 40, in nms
return torch.ops.torchvision.nms(boxes, scores, iou_threshold)
RuntimeError: Trying to create tensor with negative dimension -1203535890: [-1203535890]

yolov5使用注意

首先感谢作者的分享!
使用yolov5的小伙伴注意,里面有一些bug和一些不完善的地方,直接使用即使训练300轮的mAP依然非常底!!!比如config配置,model,loss单分类的计算,数据增强等。建议自己用yolo5源码实现,不然bug都不知道在哪。

你好,我在训练出错

Traceback (most recent call last):
File "tools/train.py", line 144, in
main()
File "tools/train.py", line 69, in main
cfg = Config.fromfile(args.config)
File "/home/tongyu/develop-project/yolodet-pytorch-master/yolodet/utils/config.py", line 174, in fromfile
cfg_dict, cfg_text = Config._file2dict(filename)
File "/home/tongyu/develop-project/yolodet-pytorch-master/yolodet/utils/config.py", line 113, in _file2dict
mod = import_module('_tempconfig')
File "/home/tongyu/.conda/envs/yolodet/lib/python3.6/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 994, in _gcd_import
File "", line 971, in _find_and_load
File "", line 955, in _find_and_load_unlocked
File "", line 665, in _load_unlocked
File "", line 674, in exec_module
File "", line 781, in get_code
File "", line 741, in source_to_code
File "", line 219, in _call_with_frames_removed
File "/tmp/tmpwcunctkd/_tempconfig.py", line 37
bbox_loss=dict(type='IOU_Loss', iou_type='GIOU',loss_weight=0.05),
^
SyntaxError: invalid syntax

onnx

是否有onnx转换支持。

请问:测试的时候出现这种错误怎么办,还有所得到的result的构成是怎样的?

错误:show_result(img, result, model.CLASSES)
File "yolodet-pytorch/yolodet/apis/inference.py", line 168, in show_result
label = rslt['label']
IndexError: too many indices for tensor of dimension 3

代码:
from yolodet.apis.inference import inference_detector,init_detector,show_result
import os

config_file ='cfg/yolov4_gpu.py'
checkpoint_file ='work_dirs/yolov4/latest.pth'

build the model from a config file and a checkpoint file

model = init_detector(config_file, checkpoint_file, device='cuda:0')

test a single image and show the results

img ='test.jpg' # or img = mmcv.imread(img), which will only load it once
result,t = inference_detector(model, img)
print('%s Done , object num : %s .time:(%.3fs)' % (img,len(result), t))

visualize the results in a new window

show_result(img, result, model.CLASSES)

关于iou-aware分支在inference时的问题

你好,我想问下在ppyolo中添加的iou-aware分支,在inference时,原论文中的iou confidence是通过α=0.4次方的形式与class的confidence的0.6次方相乘,得到inference时的confidence。
但是在代码中,yolodet/models/heads/ppyolo.py中的get_eval_bboxes函数:
new_obj = torch.pow(obj, (1 - self.iou_aware_factor)) * torch.pow(ioua, self.iou_aware_factor)
实现论文的new_obj以后还进行了-log(1/new_obj-1)的操作。
我这边实现了iou-aware后假设原new_obj为0.9,但是经过-log(1/new_obj-1)后续操作得到的confidence数值是2.19,造成了识别的confidence的范围不在0到1以内。
想请教下为什么代码中这样实现,还是说在其他地方有将其重新约束到(0,1)的操作?

File "/var/folders/l8/b9v1kgkd6nz9hl__21wh79hm0000gn/T/tmp0dmyw5s2/_tempconfig.py", line 37 bbox_loss=dict(type='IOU_Loss', iou_type='GIOU',loss_weight=0.05), ^

你好 @wuzhihao7788

我在mac上训练报错,

Traceback (most recent call last):
File "tools/train.py", line 144, in
main()
File "tools/train.py", line 69, in main
cfg = Config.fromfile(args.config)
File "/Users/youyin/Documents/人工智能研究项目/keypoint/yolodet-pytorch/yolodet/utils/config.py", line 173, in fromfile
cfg_dict, cfg_text = Config._file2dict(filename)
File "/Users/youyin/Documents/人工智能研究项目/keypoint/yolodet-pytorch/yolodet/utils/config.py", line 113, in _file2dict
mod = import_module('_tempconfig')
File "/Users/youyin/anaconda3/envs/yolodet/lib/python3.7/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load
File "", line 967, in _find_and_load_unlocked
File "", line 677, in _load_unlocked
File "", line 724, in exec_module
File "", line 860, in get_code
File "", line 791, in source_to_code
File "", line 219, in _call_with_frames_removed
File "/var/folders/l8/b9v1kgkd6nz9hl__21wh79hm0000gn/T/tmp0dmyw5s2/_tempconfig.py", line 37
bbox_loss=dict(type='IOU_Loss', iou_type='GIOU',loss_weight=0.05),
^
SyntaxError: invalid syntax

你好,我使用单卡可以训练,当使用多卡时,会出错,请问你尝试过多卡训练吗?

Traceback (most recent call last):
File "tools/train.py", line 144, in
main()
File "tools/train.py", line 140, in main
train_detector(model,datasets,cfg,validate=args.validate,timestamp=timestamp,meta=meta)
File "/data1/xieyangyang/yolodet-pytorch/yolodet/apis/train.py", line 161, in train_detector
runner.run(data_loaders, cfg.workflow, cfg.total_epochs)
File "/data1/xieyangyang/yolodet-pytorch/yolodet/apis/runner.py", line 331, in run
epoch_runner(data_loaders[i], **kwargs)
File "/data1/xieyangyang/yolodet-pytorch/yolodet/apis/runner.py", line 220, in train
self.model, data_batch, train_mode=True, **kwargs)
File "/data1/xieyangyang/yolodet-pytorch/yolodet/apis/train.py", line 116, in batch_processor
losses = model(**data)
File "/data4/xieyangyang/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 550, in call
result = self.forward(*input, **kwargs)
File "/data4/xieyangyang/anaconda3/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 155, in forward
outputs = self.parallel_apply(replicas, inputs, kwargs)
File "/data4/xieyangyang/anaconda3/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 165, in parallel_apply
return parallel_apply(replicas, inputs, kwargs, self.device_ids[:len(replicas)])
File "/data4/xieyangyang/anaconda3/lib/python3.7/site-packages/torch/nn/parallel/parallel_apply.py", line 85, in parallel_apply
output.reraise()
File "/data4/xieyangyang/anaconda3/lib/python3.7/site-packages/torch/_utils.py", line 395, in reraise
raise self.exc_type(msg)
RuntimeError: Caught RuntimeError in replica 0 on device 0.
Original Traceback (most recent call last):
File "/data4/xieyangyang/anaconda3/lib/python3.7/site-packages/torch/nn/parallel/parallel_apply.py", line 60, in _worker
output = module(*input, **kwargs)
File "/data4/xieyangyang/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 550, in call
result = self.forward(*input, **kwargs)
File "/data1/xieyangyang/yolodet-pytorch/yolodet/models/detectors/base.py", line 55, in forward
return self.forward_train(img, img_metas, **kwargs)
File "/data1/xieyangyang/yolodet-pytorch/yolodet/models/detectors/YOLOv5Detector.py", line 100, in forward_train
head_loss = self.head.loss(*head_loss_inputs)
File "/data1/xieyangyang/yolodet-pytorch/yolodet/models/heads/yolo.py", line 99, in loss
bbox_loss, confidence_loss, class_loss = multi_apply(self.loss_single, pred, indices,tbox,tcls,ancher,self.conf_balances,ignore_mask)
File "/data1/xieyangyang/yolodet-pytorch/yolodet/utils/util.py", line 32, in multi_apply
return tuple(map(list, zip(*map_results)))
File "/data1/xieyangyang/yolodet-pytorch/yolodet/models/heads/yolo.py", line 91, in loss_single
return self.yolov5_loss_single(pred, indices,tbox,tcls,anchors, conf_balances,ignore_mask)
File "/data1/xieyangyang/yolodet-pytorch/yolodet/models/heads/yolo.py", line 210, in yolov5_loss_single
pwh = (ps[:, 2:4].sigmoid() * 2) ** 2 * torch.from_numpy(anchors).to(device) # 0-4倍缩放 model.hyp['anchor_t']=4
RuntimeError: CUDA error: device-side assert triggered

dataloader 报错

RuntimeError: Caught RuntimeError in DataLoader worker process 3.
Original Traceback (most recent call last):
File "/root/.local/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 198, in _worker_loop
data = fetcher.fetch(index)
File "/root/.local/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 47, in fetch
return self.collate_fn(data)
File "/root/liyang/yolodet-pytorch/yolodet/dataset/loader/build_dataloader.py", line 92, in collate
clt[k] = torch.stack(v, 0)
RuntimeError: stack expects each tensor to be equal size, but got [3, 640, 640] at entry 0 and [3, 1280, 1280] at entry 6

是loader/build_dataloader.py 里面collate的问题?

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.