Commit 8566797f authored by Yuxin Wu's avatar Yuxin Wu

fix #1043

parent 0b2ab4ae
......@@ -7,7 +7,6 @@ import tqdm
import json
from tensorpack.utils import logger
from tensorpack.utils.argtools import log_once
from tensorpack.utils.timer import timed_operation
from config import config as cfg
......@@ -121,7 +120,7 @@ class COCODetection(object):
valid_objs = []
width = img['width']
height = img['height']
for obj in objs:
for objid, obj in objs:
if obj.get('ignore', 0) == 1:
continue
x1, y1, w, h = obj['bbox']
......@@ -145,8 +144,10 @@ class COCODetection(object):
obj['segmentation'] = None
else:
valid_segs = [np.asarray(p).reshape(-1, 2).astype('float32') for p in segs if len(p) >= 6]
if len(valid_segs) < len(segs):
log_once("Image {} has invalid polygons!".format(img['file_name']), 'warn')
if len(valid_segs) == 0:
logger.error("Object {} in image {} has no valid polygons!".format(objid, img['file_name']))
elif len(valid_segs) < len(segs):
logger.warn("Object {} in image {} has invalid polygons!".format(objid, img['file_name']))
obj['segmentation'] = valid_segs
......
......@@ -47,10 +47,10 @@ class Model(ModelDesc):
logits = (LinearWrap(image)
.Conv2D('conv0', 64, 7, strides=2, activation=BNReLU, padding='VALID')
.MaxPooling('pool0', 3, strides=2, padding='SAME')
.apply(resnet_group, 'group0', bottleneck, 64, blocks[0], 1)
.apply(resnet_group, 'group1', bottleneck, 128, blocks[1], 2)
.apply(resnet_group, 'group2', bottleneck, 256, blocks[2], 2)
.apply(resnet_group, 'group3', bottleneck, 512, blocks[3], 2)
.apply2(resnet_group, 'group0', bottleneck, 64, blocks[0], 1)
.apply2(resnet_group, 'group1', bottleneck, 128, blocks[1], 2)
.apply2(resnet_group, 'group2', bottleneck, 256, blocks[2], 2)
.apply2(resnet_group, 'group3', bottleneck, 512, blocks[3], 2)
.GlobalAvgPooling('gap')
.FullyConnected('linear', 1000)())
tf.nn.softmax(logits, name='prob')
......
......@@ -80,6 +80,9 @@ class LinearWrap(object):
Apply a function on the wrapped tensor. The tensor
will be the second argument of func.
This is because many symbolic functions
(such as tensorpack's layers) takes 'scope' as the first argument.
Returns:
LinearWrap: ``LinearWrap(func(args[0], self.tensor(), *args[1:], **kwargs))``.
"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment