提交 65da8069 编写于 作者: C chenyun

add softmax on anchor fix #67

上级 34d68f98
......@@ -64,7 +64,7 @@ def preprocess(img, min_size=600, max_size=1000):
scale2 = max_size / max(H, W)
scale = min(scale1, scale2)
img = img / 255.
img = sktsf.resize(img, (C, H * scale, W * scale), mode='reflect')
img = sktsf.resize(img, (C, H * scale, W * scale), mode='reflect',anti_aliasing=False)
# both the longer and shorter should be less than
# max_size and min_size
if opt.caffe_pretrain:
......
......@@ -112,8 +112,9 @@ class RegionProposalNetwork(nn.Module):
rpn_locs = rpn_locs.permute(0, 2, 3, 1).contiguous().view(n, -1, 4)
rpn_scores = self.score(h)
rpn_scores = rpn_scores.permute(0, 2, 3, 1).contiguous()
rpn_softmax_scores = F.softmax(rpn_scores, dim=3)
rpn_fg_scores = \
rpn_scores.view(n, hh, ww, n_anchor, 2)[:, :, :, :, 1].contiguous()
rpn_softmax_scores.view(n, hh, ww, n_anchor, 2)[:, :, :, :, 1].contiguous()
rpn_fg_scores = rpn_fg_scores.view(n, -1)
rpn_scores = rpn_scores.view(n, -1, 2)
......
from __future__ import absolute_import
# though cupy is not used but without this line, it raise errors...
import cupy as cp
import os
import ipdb
......
......@@ -26,4 +26,4 @@ def scalar(data):
if isinstance(data, np.ndarray):
return data.reshape(1)[0]
if isinstance(data, t.Tensor):
return data.view(1)[0].item()
\ No newline at end of file
return data.item()
\ No newline at end of file
......@@ -175,7 +175,7 @@ class Visualizer(object):
"""
def __init__(self, env='default', **kwargs):
self.vis = visdom.Visdom(env=env, **kwargs)
self.vis = visdom.Visdom(env=env, use_incoming_socket=False, **kwargs)
self._vis_kw = kwargs
# e.g.('loss',23) the 23th value of loss
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册