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

GhostConv() bug fix #1176

Merged
merged 1 commit into from
Oct 20, 2020
Merged

GhostConv() bug fix #1176

merged 1 commit into from
Oct 20, 2020

Conversation

uyzhang
Copy link
Contributor

@uyzhang uyzhang commented Oct 20, 2020

The parameters of Conv function:

def __init__(self, c1, c2, k=1, s=1, p=None, g=1, act=True): 

But in ghost conv:

class GhostConv(nn.Module):
    # Ghost Convolution https://github.com/huawei-noah/ghostnet
    def __init__(self, c1, c2, k=1, s=1, g=1, act=True):  # ch_in, ch_out, kernel, stride, groups
        super(GhostConv, self).__init__()
        c_ = c2 // 2  # hidden channels
        self.cv1 = Conv(c1, c_, k, s, g, act)
        self.cv2 = Conv(c_, c_, 5, 1, c_, act)

The parameter p is ignored.

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

Optimization of GhostConv layer initialization in YOLOv5's experimental model structures.

📊 Key Changes

  • Modified the GhostConv class constructors for cv1 and cv2 methods.
  • Adjusted the arguments passed to Conv function, specifically the groups (g) parameter.

🎯 Purpose & Impact

  • 🛠️ The update corrects the parameter passing by explicitly assigning None where a default value is expected, enhancing code readability and maintainability.
  • ✨ This change may improve model training stability and future proof the code by adhering to expected function signatures.
  • 🔍 Users can expect cleaner code inside the GhostConv class, possibly leading to fewer bugs and a small enhancement in performance or stability.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @LeoYZhang, thank you for submitting a PR! To allow your work to be integrated as seamlessly as possible, we advise you to:

  • Verify your PR is up-to-date with origin/master. If your PR is behind origin/master update by running the following, replacing 'feature' with the name of your local branch:
git remote add upstream https://github.com/ultralytics/yolov5.git
git fetch upstream
git checkout feature  # <----- replace 'feature' with local branch name
git rebase upstream/master
git push -u origin -f
  • Verify all Continuous Integration (CI) checks are passing.
  • Reduce changes to the absolute minimum required for your bug fix or feature addition. "It is not daily increase but daily decrease, hack away the unessential. The closer to the source, the less wastage there is." -Bruce Lee

@glenn-jocher
Copy link
Member

@LeoYZhang that's a serious bug indeed, good catch. I must have modified Conv() after I stopped experimenting with GhostConv().

Thank you for your contributions!

@glenn-jocher glenn-jocher changed the title fixed a bug of ghost conv GhostConv() bug fix Oct 20, 2020
@glenn-jocher glenn-jocher merged commit f532bc6 into ultralytics:master Oct 20, 2020
burglarhobbit pushed a commit to burglarhobbit/yolov5 that referenced this pull request Jan 1, 2021
KMint1819 pushed a commit to KMint1819/yolov5 that referenced this pull request May 12, 2021
BjarneKuehl pushed a commit to fhkiel-mlaip/yolov5 that referenced this pull request Aug 26, 2022
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

Successfully merging this pull request may close these issues.

None yet

2 participants