TorchDSP / torchsig

TorchSig is an open-source signal processing machine learning toolkit based on the PyTorch data handling pipeline.
MIT License
155 stars 37 forks source link

The problem of correspondence between the label of the spectrum chart and the mask coordinates #230

Open Jinzhu-Wang opened 6 months ago

Jinzhu-Wang commented 6 months ago

Describe the bug When I use MaskClassVisualizer to visualize IQ data, I hope to extract the coordinates of the mask and the corresponding label values. However, when I add the following code, there is a matching problem between labels and coordinates, especially a label with When using multiple masks. Please tell me what should I do

To Reproduce Code added in MaskClassVisualizerr:

            contours, _ = cv2.findContours((mask * 255).astype(np.uint8), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
            contour_coordinates = []
            for contour in contours:
                contour_coordinates.append(contour.squeeze().tolist())

            print("Contour Coordinates:", contour_coordinates)
            print("idx: ",class_idx)

Output results

            Contour Coordinates: [[[0, 420], [0, 455], [511, 455], [511, 420]], [[0, 129], [0, 204], [187, 204], [187, 129]], [[460, 99], [460, 151], [511, 151], [511, 99]]]
            idx:  [3, 4]

Expected behavior Like the above output, how should I match them