ANP-Granular / ParticleTracking

Library and GUI for tracking (rod-like) particles on camera images in 2D and 3D
https://particletracking.readthedocs.io/en/latest/
GNU General Public License v3.0
2 stars 2 forks source link

PulpSolverError on running 3D reconstruction & object detection simultaneously #72

Open a-niem opened 1 year ago

a-niem commented 1 year ago

Describe the bug

A PulpSolverError is thrown when attempting to run a 3D reconstruction in the same session as a detection has been run.

To Reproduce:

  1. Load images for 2 views.
  2. Load a detection model.
  3. Select the expected number of rods.
  4. Run rod detection on min. 2 frames
  5. Load a camera calibration.
  6. Load a world transformation.
  7. Tick the Tracking checkbox.
  8. Start the particle tracking.
  9. The tracking fails for every selected color with the logs shown below.

Expected behavior

The particles' 3D coordinates should be reconstructed tracked over the course of the selected frames.

Desktop:

Additional context:

This issue does not seem to occur when 'replacing' existing data in the session, i.e. running detection for frames that had 2D/3D-data loaded previously during the session.

This error does not occur when the detected rod position data has been saved (before(/after) the tracking has failed) and loaded in a new session. The tracking works without problems then.

Logs:

[08/14 09:40:46] RodTracker.ui.loggerwidget INFO: C:\Users\ ... \AppData\Local\ANP-Granular\RodTracker\Session_dlcovpyn
[08/14 09:41:09] RodTracker.ui.loggerwidget INFO: (camera_0) (gp1) 704 image file(s) loaded from: C:\Users\ ... \images\gp1
[08/14 09:41:16] RodTracker.ui.loggerwidget INFO: (camera_1) (gp2) 704 image file(s) loaded from: C:\Users\ ... \images\gp2
[08/14 09:41:46] py.warnings WARNING: C:\Users\ ... \venv\Lib\site-packages\torch\nn\modules\module.py:1194: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ..\aten\src\ATen\native\TensorShape.cpp:3191.)
  return forward_call(*input, **kwargs)

[08/14 09:41:47] RodTracker.ui.loggerwidget INFO: (gp2, 201) Detected 88 rods.
[08/14 09:41:47] RodTracker.ui.rodimagewidget INFO: Couldn't extract rods. Didn't find columns: ['particle', 'frame', 'x1_gp1', 'x2_gp1', 'y1_gp1', 'y2_gp1', 'seen_gp1']
[08/14 09:41:47] RodTracker.ui.rodimagewidget INFO: Couldn't extract rods. Didn't find columns: ['particle', 'frame', 'x1_gp1', 'x2_gp1', 'y1_gp1', 'y2_gp1', 'seen_gp1']
[08/14 09:41:47] RodTracker.ui.reconstruction INFO: Insufficient data for plotting given. Skipping...
[08/14 09:41:47] RodTracker.ui.reconstruction INFO: Insufficient data for plotting given. Skipping...
[08/14 09:41:47] RodTracker.ui.reconstruction INFO: Insufficient data for plotting given. Skipping...
[08/14 09:41:47] RodTracker.ui.loggerwidget INFO: (gp1, 201) Detected 88 rods.
[08/14 09:41:57] RodTracker.backend.rod_data INFO: No 2D rod position data available for frame #202.
[08/14 09:41:58] RodTracker.ui.loggerwidget INFO: (gp2, 202) Detected 88 rods.
[08/14 09:41:58] RodTracker.ui.loggerwidget INFO: (gp1, 202) Detected 88 rods.
[08/14 09:42:08] RodTracker.ui.loggerwidget INFO: (gp2, 203) Detected 88 rods.
[08/14 09:42:09] RodTracker.ui.loggerwidget INFO: (gp1, 203) Detected 88 rods.
[08/14 09:42:19] RodTracker.ui.loggerwidget INFO: (gp2, 204) Detected 88 rods.
[08/14 09:42:20] RodTracker.ui.loggerwidget INFO: (gp1, 204) Detected 88 rods.
[08/14 09:42:28] RodTracker.backend.reconstruction ERROR: Did not receive any valid particle length data. Cannot compute histogram of lengths.
[08/14 09:42:29] RodTracker.ui.loggerwidget INFO: (gp2, 205) Detected 99 rods.
[08/14 09:42:30] RodTracker.ui.loggerwidget INFO: (gp1, 205) Detected 88 rods.
[08/14 09:42:46] RodTracker.backend.rod_data INFO: Autosaved.
[08/14 09:43:22] RodTracker.backend.logger ERROR: Uncaught exception:
Traceback (most recent call last):
  File "C:\Users\ ... \venv\lib\site-packages\RodTracker\backend\reconstruction.py", line 761, in run
    tmp = matchND.match_frame(
  File "C:\Users\ ... \venv\Lib\site-packages\ParticleDetection\reconstruct_3D\matchND.py", line 483, in match_frame
    rod, cam1_ind, cam2_ind = npartite_matching(weights, maximize=True)
  File "C:\Users\ ... \venv\Lib\site-packages\ParticleDetection\reconstruct_3D\matchND.py", line 125, in npartite_matching
    problem.solve(solver)
  File "C:\Users\ ... \venv\Lib\site-packages\pulp\pulp.py", line 1913, in solve
    status = solver.actualSolve(self, **kwargs)
  File "C:\Users\ ... \venv\Lib\site-packages\pulp\apis\coin_api.py", line 137, in actualSolve
    return self.solve_CBC(lp, **kwargs)
  File "C:\Users\ ... \venv\Lib\site-packages\pulp\apis\coin_api.py", line 213, in solve_CBC
    raise PulpSolverError("Pulp: Error while executing " + self.path)
pulp.apis.core.PulpSolverError: Pulp: Error while executing C:\Users\ ... \venv\Lib\site-packages\pulp\solverdir\cbc\win\64\cbc.exe