TorchDSP / torchsig

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

Target Transform DescToBBoxSignalDict Bug #163

Closed lmaynard6 closed 1 month ago

lmaynard6 commented 1 year ago

Describe the bug There appears to be a bug in the DescToBBoxSignalDict class and likely DescToBBoxDict (untested). See Jupyter example notebook 5. The bounding box dictionary function returns labels where all four values of the 'boxes' tensor are the same versus a polygon/rectangle that outlines the signal.

The bug appears to stem from target_transforms.py lines 1068 and 1116 in code:

        boxes[signal_desc_idx] = np.array(
            [
                signal_desc.start + 0.5 * duration,
                signal_desc.lower_frequency + 0.5 + 0.5 * bandwidth,
                duration,
                bandwidth,
            ]
        )[0]  <---- Here

Instead of returning the whole vector, it just returns the first index. Deleting the [0] at the end makes it work as expected.

To Reproduce Steps to reproduce the behavior:

  1. Run 05_example_wideband_detector.ipynb as directed.
  2. Output of code cell 2 shows labels with all four tensor boxes at the same value. Output is as follows:

Label: {'labels': tensor([0, 0, 0]), 'boxes': tensor([[0.6497, 0.6497, 0.6497, 0.6497], [0.6497, 0.6497, 0.6497, 0.6497], [0.6497, 0.6497, 0.6497, 0.6497]])}

Expected behavior Bounding box label that represents time and spectrum associated with the signal(s).

Desktop (please complete the following information):

Additional context Thanks for putting this toolset together!

MattCarrickPL commented 1 month ago

The transforms and notebooks have been greatly modified recently, and given this issue is 1+ year old I'm closing it out.