EAST
EAST copied to clipboard
Has anybody implement QUAD method?
I've tried to do QUAD method in this paper,can anybody help me ,thank you very much!
I have implemented quad mode, predict the offset relative to each positive pixel, use the smooth L1 loss
@Yuanhang8605 Can I read your code for some reference? I've tried to implement it with caffe,and also used smooth L1 loss,but the normalization factor used was diffirent with the paper.I got high loss,and struggled to fix it.
@jjprincess, here is my tensorflow code :
def _localization_loss(self, pred_geo_map,
gt_geo_map, gt_score_map):
"""Cal the localization loss.
"""
# the point order: x1, y1, x2, y2, x3, y3, x4, y4
# smooth_L1 loss.
gt_geo_map = gt_geo_map / float(self._text_scale) # I set _text_scale = 50 to shrink the gt_geo_map.
gt_min_edge = gt_geo_map[:, :, :, -1]
gt_min_edge = tf.expand_dims(gt_min_edge, 3)
diff = pred_geo_map - gt_geo_map[:, :, :, :-1]
abs_diff = tf.abs(diff)
abs_diff_lt_1 = tf.less(abs_diff, 1)
L_g = tf.where(abs_diff_lt_1, 0.5 * tf.square(abs_diff), abs_diff - 0.5)
L_g = L_g / gt_min_edge
L_g = tf.reduce_mean(L_g, axis=3)
@Yuanhang8605 Thanks, I has implemented this with caffe too.^_^
@jjprincess I also got very high loss using NQ* mentioned in the paper, can you share your code for my reference? @Yuanhang8605 Do you shrink by self._text_scale to fix this?
@jjprincess, here is my tensorflow code :
def _localization_loss(self, pred_geo_map, gt_geo_map, gt_score_map): """Cal the localization loss. """ # the point order: x1, y1, x2, y2, x3, y3, x4, y4 # smooth_L1 loss. gt_geo_map = gt_geo_map / float(self._text_scale) # I set _text_scale = 50 to shrink the gt_geo_map. gt_min_edge = gt_geo_map[:, :, :, -1] gt_min_edge = tf.expand_dims(gt_min_edge, 3) diff = pred_geo_map - gt_geo_map[:, :, :, :-1] abs_diff = tf.abs(diff) abs_diff_lt_1 = tf.less(abs_diff, 1) L_g = tf.where(abs_diff_lt_1, 0.5 * tf.square(abs_diff), abs_diff - 0.5) L_g = L_g / gt_min_edge L_g = tf.reduce_mean(L_g, axis=3)
Hi @Yuanhang8605 , can you share your code for quad box? i has implemented but got the high loss, seem it not working
@jjprincess, here is my tensorflow code :
def _localization_loss(self, pred_geo_map, gt_geo_map, gt_score_map): """Cal the localization loss. """ # the point order: x1, y1, x2, y2, x3, y3, x4, y4 # smooth_L1 loss. gt_geo_map = gt_geo_map / float(self._text_scale) # I set _text_scale = 50 to shrink the gt_geo_map. gt_min_edge = gt_geo_map[:, :, :, -1] gt_min_edge = tf.expand_dims(gt_min_edge, 3) diff = pred_geo_map - gt_geo_map[:, :, :, :-1] abs_diff = tf.abs(diff) abs_diff_lt_1 = tf.less(abs_diff, 1) L_g = tf.where(abs_diff_lt_1, 0.5 * tf.square(abs_diff), abs_diff - 0.5) L_g = L_g / gt_min_edge L_g = tf.reduce_mean(L_g, axis=3)
Hi @Yuanhang8605 , can you share your code for quad box? i has implemented but got the high loss, seem it not working
Hi bro,, i am trying to implement QUAD geometry for this tensorflow EAST code. can you share your working code with me ?
@Yuanhang8605 Thanks, I has implemented this with caffe too.^_^
Hi bro how did you fix the high loss problem ?
@jjprincess, here is my tensorflow code :
def _localization_loss(self, pred_geo_map, gt_geo_map, gt_score_map): """Cal the localization loss. """ # the point order: x1, y1, x2, y2, x3, y3, x4, y4 # smooth_L1 loss. gt_geo_map = gt_geo_map / float(self._text_scale) # I set _text_scale = 50 to shrink the gt_geo_map. gt_min_edge = gt_geo_map[:, :, :, -1] gt_min_edge = tf.expand_dims(gt_min_edge, 3) diff = pred_geo_map - gt_geo_map[:, :, :, :-1] abs_diff = tf.abs(diff) abs_diff_lt_1 = tf.less(abs_diff, 1) L_g = tf.where(abs_diff_lt_1, 0.5 * tf.square(abs_diff), abs_diff - 0.5) L_g = L_g / gt_min_edge L_g = tf.reduce_mean(L_g, axis=3)
Hi bro. could you guide me where in multigpu_train.py i need to adjust this code for QUAD ?
@Yuanhang8605 Thanks, I has implemented this with caffe too.^_^
How to modify the geometry map generation for QUAD?
@jjprincess, here is my tensorflow code :
def _localization_loss(self, pred_geo_map, gt_geo_map, gt_score_map): """Cal the localization loss. """ # the point order: x1, y1, x2, y2, x3, y3, x4, y4 # smooth_L1 loss. gt_geo_map = gt_geo_map / float(self._text_scale) # I set _text_scale = 50 to shrink the gt_geo_map. gt_min_edge = gt_geo_map[:, :, :, -1] gt_min_edge = tf.expand_dims(gt_min_edge, 3) diff = pred_geo_map - gt_geo_map[:, :, :, :-1] abs_diff = tf.abs(diff) abs_diff_lt_1 = tf.less(abs_diff, 1) L_g = tf.where(abs_diff_lt_1, 0.5 * tf.square(abs_diff), abs_diff - 0.5) L_g = L_g / gt_min_edge L_g = tf.reduce_mean(L_g, axis=3)
I think these two lines just gives the last value y4 instead of smallest edge. Please correct me if I am wrong. gt_min_edge = gt_geo_map[:, :, :, -1] gt_min_edge = tf.expand_dims(gt_min_edge, 3)