CPIAD
CPIAD copied to clipboard
How is get_cls_scores implemented in yolov4_helper.py?
If you have the time, could you explain how the class scores are calculated?
Is the output of darknet_model(img) a list of class confidence levels?
What do the scores represent? Do they represent a class confidence level for each class in a picture?
def get_cls_scores(self, img:torch.tensor):
img = _input_transform(img).to(device)
output = self.darknet_model(img) # <-- what does the output represent exactly?
self.features = self.darknet_model.features
scores = []
for item in output:
h, w = item.shape[-2], item.shape[-1]
item = item.reshape(-1, 5+80, h*w).permute(1,0,2).reshape(5+80, -1) # <--- how does this reshape work?
scores += [item[4, :].sigmoid()] # <-- why 4?
return scores
Also referring to pytorch-YOLOv4, if you were to use their model how would you calculate the cls_scores? Their output is different from yours despite looking like the same functions.