1- import torch
2- import torch .nn as nn
3- import numpy as np
41import warnings
2+
3+ import numpy as np
4+ import torch
5+ from torch import nn
6+
57from openpmcvl .granular .models .network import resnet152
68from openpmcvl .granular .models .process import preprocess
79
@@ -18,7 +20,9 @@ def bboxes_iou(bboxes_a, bboxes_b, xyxy=True):
1820 bbox_b (array): An array similar to :obj:`bbox_a`,
1921 whose shape is :math:`(K, 4)`.
2022 The dtype should be :obj:`numpy.float32`.
21- Returns:
23+
24+ Returns
25+ -------
2226 array:
2327 An array whose shape is :math:`(N, K)`. \
2428 An element at index :math:`(n, k)` contains IoUs between \
@@ -72,7 +76,6 @@ def __init__(self, config_model, layer_no, in_ch, ignore_thre=0.7):
7276 in_ch (int): number of input channels.
7377 ignore_thre (float): threshold of IoU above which objectness training is ignored.
7478 """
75-
7679 super (YOLOLayer , self ).__init__ ()
7780 strides = [32 , 16 , 8 ] # fixed
7881 self .anchors = config_model ["ANCHORS" ]
@@ -111,7 +114,9 @@ def forward(self, xin, compound_labels=None):
111114 class (float): class index.
112115 xc, yc (float) : center of bbox whose values range from 0 to 1.
113116 w, h (float) : size of bbox whose values range from 0 to 1.
114- Returns:
117+
118+ Returns
119+ -------
115120 loss (torch.Tensor): total loss - the target of backprop.
116121 loss_xy (torch.Tensor): x, y loss - calculated by binary cross entropy (BCE) \
117122 with boxsize-dependent weights.
@@ -319,7 +324,6 @@ def __init__(self, config_model, layer_no, in_ch, ignore_thre=0.7):
319324 in_ch (int): number of input channels.
320325 ignore_thre (float): threshold of IoU above which objectness training is ignored.
321326 """
322-
323327 super (YOLOimgLayer , self ).__init__ ()
324328 strides = [32 , 16 , 8 ] # fixed
325329 self .anchors = config_model ["ANCHORS" ]
@@ -356,7 +360,9 @@ def forward(self, xin, all_labels=None):
356360 class (float): class index.
357361 xc, yc (float) : center of bbox whose values range from 0 to 1.
358362 w, h (float) : size of bbox whose values range from 0 to 1.
359- Returns:
363+
364+ Returns
365+ -------
360366 loss (torch.Tensor): total loss - the target of backprop.
361367 loss_xy (torch.Tensor): x, y loss - calculated by binary cross entropy (BCE) \
362368 with boxsize-dependent weights.
0 commit comments