amdegroot / ssd.pytorch

A PyTorch Implementation of Single Shot MultiBox Detector
MIT License
5.15k stars 1.75k forks source link

How to set 'aspect ratio == 1' only? #493

Open decoli opened 4 years ago

decoli commented 4 years ago

Looking at the source code in prior_box.py, we have code like pbox + = [cx, cy, ~, ~] in the forward function. If you analyze the loop with this code, pbox + = [cx, cy, scale, scale], pbox+=[cx, cy, scale_prime, scale_prime] are the parts that make the prior box size of scale and scale_prime when aspect ratio is 1.

for ar in self.aspect_ratios [k]: pbox + = [cx, cy, scale sqrt (ar), scale / sqrt (ar)] pbox + = [cx, cy, scale / sqrt (ar), scale sqrt (ar)] This is where you create your pbox based on the aspect ratio you've specified. The above is a simple look at pbox + = [cx, cy, w, h] and pbox + = [cx, cy, h, w]. In other words, you can think of reversing the axis of the aspect ratio (flip aspect ratios).

The difference between [[2]] and [[2,3]] is related to the number of prior boxes to be predicted in each feature map layer.

Originally posted by @RyuJunHwan in https://github.com/amdegroot/ssd.pytorch/issues/192#issuecomment-401987940

When I just want to set the aspect ratio to 1, how do I set ‘aspect ratio:’? I tried 'aspect ratio:[]', but this will give an error.

eltonfernando commented 3 years ago

aspect raito=1 > creates a square anchor aspect raito=0.5 >standing anchor aspect raito =2 >landscape anchor fonte: https://github.com/yehengchen/Object-Detection-and-Tracking/tree/master/OneStage/ssd