ivapylibs / Surveillance

The surveillance system for the SuperviseIt project
0 stars 1 forks source link

BG calibration broken #24

Open pv33 opened 2 years ago

pv33 commented 2 years ago

When I run code now there is a residual hand in the background model. Leads to the conclusion that tabletop calibration has changed but there is no issue notice indicating as much. Please explain here what happened and why the changes were made?

Are you really confirming that the changes are doing what they should? Are you at least documenting how existing rosbag files will fail to function? Are you even testing them?

yiyeChen commented 2 years ago

The tabletop calibration shouldn't change. I did try the new script on the default data coded in the rosbag runner, and there was no problems. I can test on other rosbag files.

Can you provide the data name on which issue happens?

pv33 commented 2 years ago

1] rosbag: ~/data/superviseit/Testing/Yunzhi/Test_human_activity/activity_multi_strict.bag 2] rosbag: ~/data/superviseit/Testing/Yunzhi/Test_human_activity/activity_single_strict.bag 3] rosbag: ~/data/superviseit/Testing/Yunzhi/Test_puzzle_solving/tangled_1_work.bag

1+2 have some kind of hand in the BG model. 3 does not have a hand in the BG model.

yiyeChen commented 2 years ago

@pv33

Problem figured out. The cause is that the configuration data is "bad". When waving over the workspace the hand stop at the starting location for too long, and didn't move away long enough. As a result, the GMM model capture the hand color as the major background element.

I show the weight sum of the Gaussian component mean below. You can see the result for the 1+2 contains hand (left): Screenshot from 2022-08-11 15-26-56

Whereas ideally it should be (the result for 3): Screenshot from 2022-08-11 15-25-34

Previously the problem does not reveal because the entire table region is used as ROI, rather than the updated black mat region. Also the default Gaussian component is updated to 3 rather than 5. More Gaussian components can capture more statistics, hence the black background is captured although veiled by the hand. Using the entire table region means that non-black region is not removed.

The current defaults are in the config/SystemDefaults.yaml (including the newly pushed SceneSegment.ROI.mode). For the data 1+2, I suggest overwriting the parameters as:

SceneSegment:
  bgGMM:
    gaussNum: 5
  ROI:
    mode: "table"
pv33 commented 2 years ago

@yiyeChen Cool. Is it safe to say then that maybe we should not be using any of the ROS bags captured by Yunzhi. Especially in light of the fact that the setup has changed? I could spend some time next week capturing new video for testing/debugging purposes.

The visualization of the background is a good thing to have. Does this mean that you have a test script that extracts it or displays it given a calibration ROS bag? Where can it be found? This is the kind of executable that would help but needs to be available and documented somewhere.

yiyeChen commented 2 years ago

@pv33

I think some of Yunzhi's bags are good to use, because he re-calibrated when capturing some data. But I have no idea which ones are good. It requires to examine one-by-one.

The toggle of the background visualization already exist in the configuration file. Since it is part of the calibration, I use the vis_calib to control whether we want to visualize the results. To turn on the switch, just put the following in the yaml:

general:
  vis_calib:    true

For now maybe I can update the documentation in the #28 ? So that the issue collect all important APIs for the Surveillance.