pytorch-retinanet | RetinaNet in PyTorch | Machine Learning library
kandi X-RAY | pytorch-retinanet Summary
kandi X-RAY | pytorch-retinanet Summary
RetinaNet in PyTorch
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Print a progress bar
- Format a time in human readable format
- Compute L1L1L1L1Loss
- Calculate the focal loss of an alternative model
- One - hot embedding
- Decodes a set of preds
- Compute the intersection of two boxes
- Make a 2d meshgrid
- Return a list of all anchors for the given image size
- Resize an image
- Test the loss function
- Randomly crop an image
- Draws the given boxes
- Collate a batch of images
- Encodes boxes and labels
- Compute the intersection between two boxes
- Change boxes of boxes
- Calculate the focal loss of the image
- Train the network
- Freeze BatchNorm layers
- Performs the forward projection
- Upsamples x and y
pytorch-retinanet Key Features
pytorch-retinanet Examples and Code Snippets
Community Discussions
Trending Discussions on pytorch-retinanet
QUESTION
I've recently read the RetinaNet paper and I have yet to understood one minor detail:
We have the multi-scale feature maps obtained from the FPN (P2,...P7).
Then the two FCN heads (the classifier head and regessor head) are convolving each one of the feature maps.
However, each feature map has different spatial scale, so, how does the classifier head and regressor head maintain fixed output volumes, given all their convolution parameters are fix? (i.e. 3x3 filter with stride 1, etc).
Looking at this line at PyTorch's implementation of RetinaNet, I see the heads just convolve each feature and then all features are stacked somehow (the only common dimension between them is the Channel dimension which is 256, but spatially they are double from each other).
Would love to hear how are they combined, I wasn't able to understand that point.
ANSWER
Answered 2020-May-12 at 18:26After the convolution at each pyramid step, you reshape the outputs to be of shape (H*W, out_dim)
(with out_dim
being num_classes * num_anchors
for the class head and 4 * num_anchors
for the bbox regressor).
Finally, you can concatenate the resulting tensors along the H*W
dimension, which is now possible because all the other dimensions match, and compute losses as you would on a network with a single feature layer.
QUESTION
I am following this repo for object detection https://github.com/yhenon/pytorch-retinanet
MotivationObject detection networks usually perform 2 tasks.For every object in the image output a class confidence score and bounding box regression score.For my task along with these 2 outputs, for every object i want to output one more regression score which will be between 0-5.
Problem statementThe approach i have taken is that since the network already does classifcation i thought i would modify some of the parts and make it a regression loss.The loss used in the repo mentioned above is focal loss.Part of what the classification loss looks like is described below, i would like to modify this to be a regression loss.
...ANSWER
Answered 2020-Jan-29 at 09:39If I understand it correctly you want to add another regression parameter which should have values in [0-5].
Instead of trying to change the classification part you can just add it to the box regression part. So you add one more parameter to predict for every anchor.
Here is the loss calculation for the regression parameters. If you added one parameter to every anchor (probably by increasing the filter count in the last layer) you have to "extract" it here like with the other parameters. You also probably want to think about the activation for the value e.g. sigmoid so you get something between 0 and 1, you can rescale to 0-5 if you want.
After line 107 you want to add something like this
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install pytorch-retinanet
You can use pytorch-retinanet like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page