Giter Site home page Giter Site logo

Comments (5)

lartpang avatar lartpang commented on May 25, 2024
        if self.offset_range_factor > 0:
            offset_range = torch.tensor([1.0 / Hk, 1.0 / Wk], device=device).reshape(1, 2, 1, 1)
            offset = offset.tanh().mul(offset_range).mul(self.offset_range_factor)

        offset = einops.rearrange(offset, "b p h w -> b h w p")
        reference = self._get_ref_points(Hk, Wk, B, dtype, device)  # B H W 2

        if self.no_off:
            offset = offset.fill(0.0)
        if self.offset_range_factor >= 0:
            pos = offset + reference
        else:
            pos = (offset + reference).tanh()

if self.offset_range_factor >= 0:

reference: [0.5, H-0.5] -> [0.5/H, 1-0.5/H] -> [1/H, 2-1/H] -> [1/H-1, 1-1/H]
offset: [-1, 1] -> [-1/H,1/H] -> [-s/H, s/H] (s=self.offset_range_factor)
offset + reference: [-(1-1/H)-s/H, 1-1/H+s/H]

from dat.

simplify23 avatar simplify23 commented on May 25, 2024

I mean why? why not just [1/H, 1/H]? why offset_range_factor will work better? Maybe some exp?

from dat.

lartpang avatar lartpang commented on May 25, 2024

@simplify23

Update:

        if self.offset_range_factor > 0:
            offset_range = torch.tensor([1.0 / Hk, 1.0 / Wk], device=device).reshape(1, 2, 1, 1)
            offset = offset.tanh().mul(offset_range).mul(self.offset_range_factor)

        offset = einops.rearrange(offset, "b p h w -> b h w p")
        reference = self._get_ref_points(Hk, Wk, B, dtype, device)  # B H W 2

        if self.no_off:
            offset = offset.fill(0.0)
        if self.offset_range_factor >= 0:
            pos = offset + reference
        else:
            pos = (offset + reference).tanh()

if self.offset_range_factor >= 0:

  • reference: Get the normalized base coordinate grid.
  • offset: [-1, 1] -> [-1/H,1/H] -> [-s/H, s/H] (s=self.offset_range_factor) Here, the offset is a relative offset from the pixel position and 1/H is the unit offset on the H-axis (up or down). Similarly, 1/W is the unit offset on the W-axis (left or right). Specifying different unit offsets ensures that s has the same units in different axes.
  • offset + reference: This results in sample positions corresponding to different reference positions after the relative offset is applied.

from dat.

Vladimir2506 avatar Vladimir2506 commented on May 25, 2024

The reference points are set to a uniform grid from 0.5 to -0.5 in size. The .mul_(2).sub_(1) operation normalizes the coordinates into [-1,+1] to meet the protocol of the grid sampling operation F.grid_sample in PyTorch, where (-1, -1) denotes the top-left corner and (+1, +1) denotes the bottom-right corner. The experiments on ablating offset range factor s are in the ablation study sections in the paper.

from dat.

Kuanch avatar Kuanch commented on May 25, 2024

Happen to find this problem when I have the same question, so in the paper
image

And also there are actually ablation studies on page 8.

from dat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.