MhLiao / DB

A PyTorch implementation of "Real-time Scene Text Detection with Differentiable Binarization".
2.08k stars 477 forks source link

when validate in training errors raise with Art data #316

Open cqray1990 opened 2 years ago

cqray1990 commented 2 years ago
self.validate(validation_loaders, model, epoch, self.steps)

B/trainer.py", line 153, in validate metrics, vis_images = self.validate_step(loader, model, False) DB/trainer.py", line 174, in validate_step batch, output) ValueError: not enough values to unpack (expected 2, got 1)

maybe bug ?

        raw_metric, interested = self.structure.measurer.validate_measure(
            batch, output)
errolseo commented 2 years ago

In the code, there are two type of validate_measure function, QuadMeasurer and ICDARDetectionMeasurer.

# DB/structure/measurers/quad_measurer.py
class QuadMeasurer(Configurable):
   ...
    def validate_measure(self, batch, output, is_output_polygon=False, box_thresh=0.6):
        return self.measure(batch, output, is_output_polygon, box_thresh)
# DB/structure/measurers/icdar_detection_measurer.py
class ICDARDetectionMeasurer(Configurable):
    ...
    def validate_measure(self, batch, output):
        return self.measure(batch, output), [int(self.visualized)]

\ The return values ​​of the two functions are different, but condition state is not defined. And most of the configuration files use QuadMeasurer, but validate function is written based on ICDARDetectionMeasurer.

# DB/experiments/seg_detector/totaltext_resnet50_deform_thre.yaml
...
        measurer:
            class: QuadMeasurer

\ It seems difficult to proceed with the validation step without modifying the code because there are many other issues.

ming-eng commented 2 years ago

I chose CDARDetectionMeasurer will meet the same question

yinfan98 commented 2 years ago

raw_metric, interested = self.structure.measurer.validate_measure( batch, output) i just delete the para interseted and then it works