Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What's the Focus layer? #207

Closed
maykulkarni opened this issue Jun 26, 2020 · 5 comments
Closed

What's the Focus layer? #207

maykulkarni opened this issue Jun 26, 2020 · 5 comments

Comments

@maykulkarni
Copy link

I see a focus layer after the input

class Focus(nn.Module):
    # Focus wh information into c-space
    def __init__(self, c1, c2, k=1):
        super(Focus, self).__init__()
        self.conv = Conv(c1 * 4, c2, k, 1)

    def forward(self, x):  # x(b,c,w,h) -> y(b,4c,w/2,h/2)
        return self.conv(torch.cat([x[..., ::2, ::2],
                                    x[..., 1::2, ::2],
                                    x[..., ::2, 1::2],
                                    x[..., 1::2, 1::2]], 1))

Which transforms:

[[[[ 0,  1,  2,  3],
   [ 4,  5,  6,  7],
   [ 8,  9, 10, 11],
   [12, 13, 14, 15]]]]

to 

[[[[ 0,  2],
   [ 8, 10]],

  [[ 4,  6],
  [12, 14]],

  [[ 1,  3],
   [9, 11]],

  [[5,  7],
  [13, 15]]]]

Which sort of seems like a downsample, but why not use DownSample directly? What does this accomplish and is there any literature I can read about this technique?

@github-actions
Copy link
Contributor

github-actions bot commented Jun 26, 2020

Hello @maykulkarni, thank you for your interest in our work! Please visit our Custom Training Tutorial to get started, and see our Jupyter Notebook Open In Colab, Docker Image, and Google Cloud Quickstart Guide for example environments.

If this is a bug report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.

If this is a custom model or data training question, please note that Ultralytics does not provide free personal support. As a leader in vision ML and AI, we do offer professional consulting, from simple expert advice up to delivery of fully customized, end-to-end production solutions for our clients, such as:

  • Cloud-based AI systems operating on hundreds of HD video streams in realtime.
  • Edge AI integrated into custom iOS and Android apps for realtime 30 FPS video inference.
  • Custom data training, hyperparameter evolution, and model exportation to any destination.

For more information please visit https://www.ultralytics.com.

@bonlime
Copy link

bonlime commented Jun 29, 2020

check TResNet paper. p2. They call it SpaceToDepth

@seekFire
Copy link

seekFire commented Jul 2, 2020

@maykulkarni I think It is the inverse operation of pixelshuffle

@violet17
Copy link

What's the difference between Focus layer and reorg layer in YOLOv1?

@wilile26811249
Copy link

@violet17 Focus is equal to the reorg layer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants