Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration of the ML based online Ecal DQM using autoencoder network [CMSSW_12_0_X] #35991

Merged
merged 5 commits into from Nov 12, 2021

Conversation

abhih1
Copy link
Contributor

@abhih1 abhih1 commented Nov 4, 2021

PR description:

This PR introduces a machine learning based anomaly detection feature to the online ECAL DQM for the Ecal Barrel through a new DQM Client MLClient. An Autoencoder (AE) model with a ResNet architecture is trained on certified good data (EB digi occupancy) from 2018 runs.
On giving an input occupancy map to the AE, the encoder part of the AE encodes and learns the features and the decoder reconstructs the data from the encoded latent space to match the input as closely as possible. The reconstruction loss is then calculated, which is a mean squared error (MSE) between the input and output images at a tower level. Thus given an anomalous tower, the AE which has learnt the features of the good data will have a hard time reconstructing it and give a higher loss on the anomaly than on the good towers. A quality threshold is then applied on this loss map which marks it as Good or Bad, which is then stored as an ML quality summary plot.

We also do some pre processing and post processing steps to have a uniform, robust anomaly detection with fewer false positives over the changing detector conditions. The details of this are included in the comments throughout the code, and also can be found in this talk presented at a central DQM meeting [1]

Please note that the ML quality summary plot is a complimentary plot in addition to the existing DQM plots, and will be used for ECAL internal consumption only pending successful commissioning.
Along with the main ML quality summary plot, we also introduce a few monitoring plots to monitor the trends in Pileup (PU) per lumisection, no.of events processed in a lumisection and no.of events per input image to the ML model. This is in anticipation of the low luminosity expected during the start of Run 3. A few hyper parameters of our pre and post processing steps will also have to be tuned according to these trends, as currently they are derived from the conditions of Run 2.


Please also note that this version of the PR is only meant for code integrations tests during the November 2021 MWGR. The plots will only be meaningful when we have real collisions, and modifications are foreseen after gathering data from the beginning of Run 3.

[1] https://indico.cern.ch/event/1042141/contributions/4377869/attachments/2254007/3824216/ML4DQM_AbhiramiHarilal_May28.pdf

PR validation:

The code was validated by running the modified online Ecal DQM configuration with the new client enabled and the resultant plots were examined by uploading the output file to a DQM test gui.
The new plots are confirmed and look reasonable.

if this PR is a backport please specify the original PR and why you need to backport that PR:

This is a backport of #35990.
This is made to ensure that these changes are available for data taking during the November 2021 MWGR, which uses 12_0_X for production.

@cmsbuild
Copy link
Contributor

cmsbuild commented Nov 4, 2021

A new Pull Request was created by @abhih1 (Abhirami Harilal) for CMSSW_12_0_X.

It involves the following packages:

  • DQM/EcalMonitorClient (dqm)
  • DQM/EcalMonitorTasks (dqm)
  • DQM/Integration (dqm)

@emanueleusai, @ahmad3213, @cmsbuild, @jfernan2, @pmandrik, @pbo0, @rvenditti can you please review it and eventually sign? Thanks.
@batinkov, @battibass, @rchatter, @argiro, @thomreis, @simonepigazzini, @threus, @francescobrivio this is something you requested to watch as well.
@perrotta, @dpiparo, @qliphy you are the release manager for this.

cms-bot commands are listed here

PUcorr_slope = 8625.62354249
PUcorr_intercept= 354776.97564344
#Avg Occupancy of 2018 data
avgOcc = (1.4228867,1.4111477,1.4235557,1.403253 ,1.2926203,1.3110067,1.4317631,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if this is the preferred way to store this large information in CMSSW; I let @qliphy and @perrotta to comment

@jfernan2
Copy link
Contributor

jfernan2 commented Nov 5, 2021

For the onnx file, I am afraid that normally for data files we have a dedicated package in https://github.com/cms-data corresponding to the cmssw package. For DQM there is for instance https://github.com/cms-data/DQM-SiStripMonitorClient and https://github.com/cms-data/DQM-DTMonitorClient . So i suggest to have a cms-data DQM-EcalMonitorClient package where the data files are moved. @smuzaffar What else should we add to get it working? A corresponding entry in CMSDIST, as https://github.com/cms-sw/cmsdist/blob/IB/CMSSW_10_2_X/gcc630/data-DQM-SiStripMonitorClient.spec right?

@smuzaffar
Copy link
Contributor

@jfernan2 , just a data repo with a PR enough to test ( bot takes care of adding the new data package in cmsdist).

@jfernan2
Copy link
Contributor

jfernan2 commented Nov 5, 2021

Thanks @smuzaffar
Do we have rights to create such repo or do you take care of that?
Thank you

@smuzaffar
Copy link
Contributor

I can take care of it, are you happy with the new package name a DQM/EcalMonitorClient ? If yes then I can create the data repo

@jfernan2
Copy link
Contributor

jfernan2 commented Nov 5, 2021

I think so, it goes in consonance with previous DQM package names, since at the end the Client is making use of this onnx file.
Please confirm us if/when @abhih1 should remove the onnx file from this PR and its forwardports to master and 12_1_X
Thank you very much

@smuzaffar
Copy link
Contributor

https://github.com/cms-data/DQM-EcalMonitorClient is now available, please open a PR there for the new data file. cleanup this PR and remove the data file from the history

@cmsbuild
Copy link
Contributor

cmsbuild commented Nov 5, 2021

Pull request #35991 was updated. @emanueleusai, @ahmad3213, @cmsbuild, @jfernan2, @pmandrik, @pbo0, @rvenditti can you please check and sign again.

@smuzaffar
Copy link
Contributor

@abhih1 , squash your two commits (to get rid of data file from git history) and force push your changes

@cmsbuild
Copy link
Contributor

cmsbuild commented Nov 5, 2021

Pull request #35991 was updated. @emanueleusai, @ahmad3213, @cmsbuild, @jfernan2, @pmandrik, @pbo0, @rvenditti can you please check and sign again.

@abhih1
Copy link
Contributor Author

abhih1 commented Nov 5, 2021

@abhih1 , squash your two commits (to get rid of data file from git history) and force push your changes

@smuzaffar Thanks. I have done this now, and made a PR to https://github.com/cms-data/DQM-EcalMonitorClient.
Just to understand, so the path to the onnx file mentioned in the client DQM/EcalMonitorClient/onnxModels/resnet.onnx should be changed or will it point to the data repository?

@smuzaffar
Copy link
Contributor

@abhih1 , yes path should be DQM/EcalMonitorClient/data/onnxModels/resnet.onnx

@abhih1
Copy link
Contributor Author

abhih1 commented Nov 5, 2021

Thanks. I'll update this as well.

@cmsbuild
Copy link
Contributor

cmsbuild commented Nov 5, 2021

Pull request #35991 was updated. @emanueleusai, @ahmad3213, @cmsbuild, @jfernan2, @pmandrik, @pbo0, @rvenditti can you please check and sign again.

@jfernan2
Copy link
Contributor

jfernan2 commented Nov 5, 2021

This PR is related to cms-data/DQM-EcalMonitorClient#1

@jfernan2
Copy link
Contributor

jfernan2 commented Nov 5, 2021

@smuzaffar it is not clear to me in which point we can trigger the tests, I do not see yet the cmsdist file created by the bot. Please let us know. Thanks

@smuzaffar
Copy link
Contributor

please test with cms-data/DQM-EcalMonitorClient#1

@smuzaffar
Copy link
Contributor

@smuzaffar it is not clear to me in which point we can trigger the tests, I do not see yet the cmsdist file created by the bot. Please let us know. Thanks

bot automatically creates the cmsdist files, so once data pr is ready then one can already start testing

@jfernan2
Copy link
Contributor

jfernan2 commented Nov 8, 2021

OK, I see, in that case it will be difficult to test that plot until real collisions arrive....

@abhih1
Copy link
Contributor Author

abhih1 commented Nov 8, 2021

yes unfortunately

@cmsbuild
Copy link
Contributor

cmsbuild commented Nov 8, 2021

Pull request #35991 was updated. @emanueleusai, @ahmad3213, @cmsbuild, @jfernan2, @pmandrik, @pbo0, @rvenditti can you please check and sign again.

@jfernan2
Copy link
Contributor

jfernan2 commented Nov 8, 2021

please test

@cmsbuild
Copy link
Contributor

cmsbuild commented Nov 8, 2021

-1

Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-f72a6e/20343/summary.html
COMMIT: 1de34de
CMSSW: CMSSW_12_0_X_2021-11-08-1100/slc7_amd64_gcc900
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week0/cms-sw/cmssw/35991/20343/install.sh to create a dev area with all the needed externals and cmssw changes.

External Build

I found compilation error when building:

Generated cache: external+classlib+3.1.3-fa415b2061ef54fdf7db6d6fb07f0a50
FATAL: malformed spec found while quering it. Command: 
source /data/cmsbld/jenkins/workspace/ib-run-pr-tests/testBuildDir/slc7_amd64_gcc900/rpm-env.sh ;  rpm -q --specfile /data/cmsbld/jenkins/workspace/ib-run-pr-tests/testBuildDir/tmp/tmpspec-coral --info --define "cmsdist_directory /data/cmsbld/jenkins/workspace/ib-run-pr-tests/cmsdist" --define "compilerv 930" --define "cmscompilerv 900" --define "cmsos slc7_amd64" --define "package_vectorization %{nil}" --define 'buildroot /foo'
Resulted in:

error: line 424: Unknown tag: <<<<<<< HEAD
error: query of specfile /data/cmsbld/jenkins/workspace/ib-run-pr-tests/testBuildDir/tmp/tmpspec-coral failed, can't parse
Traceback (most recent call last):
  File "./pkgtools/cmsBuild", line 4594, in 
    build(opts, args[1:], PKGFactory)
  File "./pkgtools/cmsBuild", line 3871, in build


@smuzaffar
Copy link
Contributor

please test

@smuzaffar
Copy link
Contributor

@jfernan2 , please use cms-sw/cmsdist#7434 for 12.0.X testing

@cmsbuild
Copy link
Contributor

cmsbuild commented Nov 9, 2021

+1

Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-f72a6e/20349/summary.html
COMMIT: 1de34de
CMSSW: CMSSW_12_0_X_2021-11-08-1100/slc7_amd64_gcc900
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week0/cms-sw/cmssw/35991/20349/install.sh to create a dev area with all the needed externals and cmssw changes.

Comparison Summary

Summary:

  • No significant changes to the logs found
  • Reco comparison results: 4 differences found in the comparisons
  • DQMHistoTests: Total files compared: 39
  • DQMHistoTests: Total histograms compared: 2998564
  • DQMHistoTests: Total failures: 5
  • DQMHistoTests: Total nulls: 1
  • DQMHistoTests: Total successes: 2998536
  • DQMHistoTests: Total skipped: 22
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: -0.004 KiB( 38 files compared)
  • DQMHistoSizes: changed ( 312.0 ): -0.004 KiB MessageLogger/Warnings
  • Checked 165 log files, 37 edm output root files, 39 DQM output files
  • TriggerResults: no differences found

@jfernan2
Copy link
Contributor

+1
Tested in Online DQM at P5

@cmsbuild
Copy link
Contributor

This pull request is fully signed and it will be integrated in one of the next CMSSW_12_0_X IBs (tests are also fine) and once validation in the development release cycle CMSSW_12_2_X is complete. This pull request will now be reviewed by the release team before it's merged. @perrotta, @dpiparo, @qliphy (and backports should be raised in the release meeting by the corresponding L2)

@qliphy
Copy link
Contributor

qliphy commented Nov 12, 2021

+1

@cmsbuild cmsbuild merged commit d2fb117 into cms-sw:CMSSW_12_0_X Nov 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants