Coder Social home page Coder Social logo

bobo0810 / pytorchnethub Goto Github PK

View Code? Open in Web Editor NEW
596.0 14.0 144.0 61.02 MB

项目注释+论文复现+算法竞赛+Pytorch实践

License: MIT License

Python 20.69% Jupyter Notebook 79.23% Shell 0.04% Cython 0.04%
faster-rcnn ssd yolov3 cam unet s4nd yolov4 dynamicrelu broadface hs-resnet

pytorchnethub's Issues

pytorch1.0 RuntimeError: CUDA out of memory (yolov1)

在1.0下跑,刚开始gpu就没内存了,没找到原因。
line 119, in train
loss.backward()
File "/home/dawn/anaconda3/lib/python3.7/site-packages/torch/tensor.py", line 102, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph)
File "/home/dawn/anaconda3/lib/python3.7/site-packages/torch/autograd/init.py", line 90, in backward
allow_unreachable=True) # allow_unreachable flag
RuntimeError: CUDA out of memory. Tried to allocate 23.00 MiB (GPU 0; 1.95 GiB total capacity; 1.46 GiB already allocated; 18.19 MiB free; 7.47 MiB cached)

RuntimeError

你好,我在win10上运行该程序遇到了如下报错:RuntimeError: The shape of the mask [32, 8732] at index 0 does not match the shape of the indexed tensor [279424, 1] at index 0 不知道你有什么解决办法吗。

Input must be >=2-d

Hello sir, when I tried to run your demo, I met several obstacles. Can you help me with the error of that? Thanks a lot

Traceback (most recent call last):
File "main.py", line 255, in
train()
File "main.py", line 102, in train
for i, (images, target) in enumerate(train_loader):
File "/home/anaconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 286, in next
return self._process_next_batch(batch)
File "/home/anaconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 307, in _process_next_batch
raise batch.exc_type(batch.exc_msg)
ValueError: Traceback (most recent call last):
File "/home/anaconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 57, in _worker_loop
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/anaconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 57, in
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/Downloads/project/AnnotatedNetworkModelGit/Yolov1_pytorch/data/dataset.py", line 78, in getitem
img, boxes = self.random_flip(img, boxes)
File "/home/Downloads/project/AnnotatedNetworkModelGit/Yolov1_pytorch/data/dataset.py", line 287, in random_flip
im_lr = np.fliplr(im).copy()
File "/home/anaconda3/lib/python3.6/site-packages/numpy/lib/twodim_base.py", line 82, in fliplr
raise ValueError("Input must be >= 2-d.")
ValueError: Input must be >= 2-d.

It's occured in yolov1.

请教一个YOLOv1的内容

file_root = '/home/zhuhui/data/VOCdevkit/VOC2012/JPEGImages/' #VOC2012的训练集
test_root = '/home/zhuhui/data/VOCdevkit/VOC2007/JPEGImages/' #VOC2007的测试集
train_Annotations = '/home/zhuhui/data/VOCdevkit/VOC2012/Annotations/'
voc_2007test='/home/bobo/PycharmProjects/torchProjectss/YOLOv1ByBobo/data/voc2007test.txt'
voc_2012train='/home/bobo/PycharmProjects/torchProjectss/YOLOv1ByBobo/data/voc2012train.txt'

test_img_dir='/home/bobo/PycharmProjects/torchProjectss/YOLOv1ByBobo/testImgs/a.jpg'
result_img_dir='/home/bobo/PycharmProjects/torchProjectss/YOLOv1ByBobo/testImgs/result_a.jpg'

在config.py文件中,这些是什么意思呢?好像自己的电脑也没有这些文件夹,要怎么创立使用呢?谢谢答疑

CPU占用高,而GPU占用低

请问大佬,我用自己的数据集训练YOLO的时候CPU占用很高(100%),而GPU使用率只有10%左右,显存占用倒是有60-70%,请问是什么原因导致的呢?怎样提高GPU的使用率?

对utils文件中utils.py 中的build_targets函数有一些疑问

# [16,3,13,13] 全1 然后将 负责预测物体的网格及 它周围的网格 都置为0 不参与训练 ,然后 将负责预测物体的网格再次置为1。 # 即总体**为: 负责预测物体的网格 位置置为1,它周围的网格置为0。类似NMS 非极大值抑制 conf_mask[b, best_n, gj, gi] = 1

conf_mask的意思应该是表示I_{ij}^{noobj}即表示第i 个grid cell的第j个anchor box不负责该目标,如果不负责目标,其值为1,否则其值 为0。
你的代码正好相反,如果不负责目标值为0, 否则值为1. 希望作者帮忙解决一下,看看是不是我理解错了

关于训练的问题

请问为什么我改为自己的单类目标检测,训练自己标注的数据(不在coco的80类里面)
ground truth使用的是原作者最后使用的0-1的归一化xywh
结果那训练集进行检测,什么都检测不出来?是不是这里的ground truth格式不对?

关于数据集存放的问题

您好,请问咱们这个模型的数据集是不是COCO格式的,我之前是VOC格式的。

如果是的话,我已经转换成COCO格式了,但是请问这个数据集格式应该放在哪个文件夹里面。

现在训练的时候好像没有读取我的训练集,自己也训练了,我找了好久也不知道数据集应该放在哪里。

是不是训练的图片和.json文件需要一起放到你config.py指定的samples文件夹里面。

yolov1训练时loss为nan

您好,我在用yolov1的代码时候,用main.py训练,数据集合只用了VOC2007的数据,pytorch用的1.2,修改了total_loss += loss.data[0],改为total_loss += loss.item(),训练的时候loss一直是nan,别的参数没改,请问一下这是什么原因啊

对于YOLOv3的损失函数,有一个地方不是很懂

util.py
206 conf_mask[b, anch_ious > ignore_thres] = 0 #[16,3,13,13]
220 conf_mask[b, best_n, gj, gi] = 1 #[16,3,13,13]

这两句话是在一个迭代里面的,第一个操作处理的是一个13*13的界面,这个时候会把这个界面清零,后面将负责预测物体的网格 位置置为1,它周围的网格置为0。

可是在迭代进行这个操作以后,一张图片的第二次迭代时,可能会对同一个界面进行处理啊(b不变),把第一次迭代置的1又给清楚掉

交并比中为什么需要加1

def bbox_iou(box1, box2, x1y1x2y2=True):
"""
Returns the IoU of two bounding boxes
"""
if not x1y1x2y2:
# Transform from center and width to exact coordinates
b1_x1, b1_x2 = box1[:, 0] - box1[:, 2] / 2, box1[:, 0] + box1[:, 2] / 2
b1_y1, b1_y2 = box1[:, 1] - box1[:, 3] / 2, box1[:, 1] + box1[:, 3] / 2
b2_x1, b2_x2 = box2[:, 0] - box2[:, 2] / 2, box2[:, 0] + box2[:, 2] / 2
b2_y1, b2_y2 = box2[:, 1] - box2[:, 3] / 2, box2[:, 1] + box2[:, 3] / 2
else:
# Get the coordinates of bounding boxes
b1_x1, b1_y1, b1_x2, b1_y2 = box1[:,0], box1[:,1], box1[:,2], box1[:,3]
b2_x1, b2_y1, b2_x2, b2_y2 = box2[:,0], box2[:,1], box2[:,2], box2[:,3]

# get the corrdinates of the intersection rectangle
inter_rect_x1 =  torch.max(b1_x1, b2_x1)
inter_rect_y1 =  torch.max(b1_y1, b2_y1)
inter_rect_x2 =  torch.min(b1_x2, b2_x2)
inter_rect_y2 =  torch.min(b1_y2, b2_y2)
# Intersection area 这一步的加1
inter_area =    torch.clamp(inter_rect_x2 - inter_rect_x1 + 1, min=0) * \
                torch.clamp(inter_rect_y2 - inter_rect_y1 + 1, min=0)
# Union Area 这一步的加1
b1_area = (b1_x2 - b1_x1 + 1) * (b1_y2 - b1_y1 + 1)
b2_area = (b2_x2 - b2_x1 + 1) * (b2_y2 - b2_y1 + 1)

iou = inter_area / (b1_area + b2_area - inter_area + 1e-16)

return iou

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.