Skip to content

Commit

Permalink
rename class autoShape -> AutoShape (ultralytics#3173)
Browse files Browse the repository at this point in the history
* rename class autoShape -> AutoShape

follow other class naming convention

* rename class autoShape -> AutoShape

follow other classes' naming convention

* rename class autoShape -> AutoShape
  • Loading branch information
developer0hye authored May 16, 2021
1 parent 17b0f71 commit be86c21
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions models/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,18 +223,18 @@ def forward(self, x):
return non_max_suppression(x[0], conf_thres=self.conf, iou_thres=self.iou, classes=self.classes)


class autoShape(nn.Module):
class AutoShape(nn.Module):
# input-robust model wrapper for passing cv2/np/PIL/torch inputs. Includes preprocessing, inference and NMS
conf = 0.25 # NMS confidence threshold
iou = 0.45 # NMS IoU threshold
classes = None # (optional list) filter by class

def __init__(self, model):
super(autoShape, self).__init__()
super(AutoShape, self).__init__()
self.model = model.eval()

def autoshape(self):
print('autoShape already enabled, skipping... ') # model already converted to model.autoshape()
print('AutoShape already enabled, skipping... ') # model already converted to model.autoshape()
return self

@torch.no_grad()
Expand Down
6 changes: 3 additions & 3 deletions models/yolo.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,9 @@ def nms(self, mode=True): # add or remove NMS module
self.model = self.model[:-1] # remove
return self

def autoshape(self): # add autoShape module
logger.info('Adding autoShape... ')
m = autoShape(self) # wrap model
def autoshape(self): # add AutoShape module
logger.info('Adding AutoShape... ')
m = AutoShape(self) # wrap model
copy_attr(m, self, include=('yaml', 'nc', 'hyp', 'names', 'stride'), exclude=()) # copy attributes
return m

Expand Down

0 comments on commit be86c21

Please sign in to comment.