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

Fixed deprecation issues and made compatible with newest pytorch and CUDA versions #125

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
fix: replaced np.float with np.float32
  • Loading branch information
dani committed Nov 15, 2024
commit 452062df93f7f44b695e68808399cbfc854d467c
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ def evaluateBoxMatches(matches, args):

# Here we hold the results
# First dimension is class, second overlap
ap = np.zeros((len(minRegionSizes), len(args.instLabels), len(overlaps)), np.float)
ap = np.zeros((len(minRegionSizes), len(args.instLabels), len(overlaps)), np.float32)

for dI, minRegionSize in enumerate(minRegionSizes):
for (oI, overlapTh) in enumerate(overlaps):
Expand Down Expand Up @@ -650,7 +650,7 @@ def evaluateMaskMatches(matches, args):

# Here we hold the results
# First dimension is class, second overlap
ap = np.zeros((len(minRegionSizes), len(args.instLabels), len(overlaps)), np.float)
ap = np.zeros((len(minRegionSizes), len(args.instLabels), len(overlaps)), np.float32)

for dI, minRegionSize in enumerate(minRegionSizes):
for (oI, overlapTh) in enumerate(overlaps):
Expand Down
6 changes: 3 additions & 3 deletions mega_core/modeling/rpn/anchor_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,16 +226,16 @@ def generate_anchors(
"""
return _generate_anchors(
stride,
np.array(sizes, dtype=np.float) / stride,
np.array(aspect_ratios, dtype=np.float),
np.array(sizes, dtype=np.float32) / stride,
np.array(aspect_ratios, dtype=np.float32),
)


def _generate_anchors(base_size, scales, aspect_ratios):
"""Generate anchor (reference) windows by enumerating aspect ratios X
scales wrt a reference (0, 0, base_size - 1, base_size - 1) window.
"""
anchor = np.array([1, 1, base_size, base_size], dtype=np.float) - 1
anchor = np.array([1, 1, base_size, base_size], dtype=np.float32) - 1
anchors = _ratio_enum(anchor, aspect_ratios)
anchors = np.vstack(
[_scale_enum(anchors[i, :], scales) for i in range(anchors.shape[0])]
Expand Down