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

labels filling correctly? #35

Closed
twongjirad opened this issue May 29, 2016 · 5 comments
Closed

labels filling correctly? #35

twongjirad opened this issue May 29, 2016 · 5 comments

Comments

@twongjirad
Copy link
Member

twongjirad commented May 29, 2016

From the Filler:

  [INFO]  <SimpleFiller::fill_entry_data::L320> Label to Datum: 1
  [INFO]  <test::_batch_process_::L259> Processed good event: valid entry counter = 2
  [INFO]  <test::_batch_process_::L248> Processing entry: 8378
  [INFO]  <testIOManager::get_data::L494> Setting event id (5360,0,35)
  [INFO]  <SimpleFiller::fill_entry_data::L307>     Cosmic PdgCode=0
Vertex   (x, y, z, t) = (0,0,0,0)
Momentum (px, py, pz) = (0,0,0)
Inittial Energy = 0
Deposit  Energy = 0
# Bounding Box  = 0

Looking into the ROOT file:

root [1] partroi_tpc_tree->Show(8378)
======> EVENT:8378
 partroi_tpc_branch = (larcv::EventROI*)0x4e8f630
 _producer       = tpc
 _run            = 5607
 _subrun         = 73
 _event          = 3672
 _part_v         = (vector<larcv::ROI>*)0x4e8f680
 _part_v._index  = 0, 1, 2, 3, 4
 _part_v._shape  = 2, 1, 1, 1, 1
 _part_v._type   = 2, 6, 9, 8, 8
 _part_v._mcst_index = 65535, 0, 1, 2, 4
 _part_v._mct_index = 0, 0, 0, 0, 0

Labeled as cosmic, but definitely a neutrino image.

—— the code ——

// labels
    ROIType_t roi_type = kROICosmic;
    for(auto const& roi : roi_v) {
      if(roi.MCSTIndex() != kINVALID_USHORT) continue;
      roi_type = roi.Type();
      if(roi_type == kROIUnknown) roi_type = PDG2ROIType(roi.PdgCode());
      LARCV_INFO() << roi.dump() << std::endl;
      break;
    }

    // Convert type to class
    size_t caffe_class = _roitype_to_class[roi_type];

    if(caffe_class == kINVALID_SIZE) {
      LARCV_CRITICAL() << "ROIType_t " << roi_type << " is not among those defined for final set of class!" << std::endl;
      throw larbys();
    }

    _label = (float)(_roitype_to_class[roi_type]);

Diagnosis

In the loop, the first entry it sees is a cosmic ROI.

It then breaks, missing the MC ROIs behind it. This get's labeled as cosmic, but it's a neutrino.

@twongjirad
Copy link
Member Author

Why doesn't this happen every time?

Example of correct label:

    [INFO]  <test::_batch_process_::L248> Processing entry: 1783
      [INFO]  <testIOManager::get_data::L494> Setting event id (5498,22,1118)
      [INFO]  <SimpleFiller::fill_entry_data::L307>     BNB PdgCode=14
    Vertex   (x, y, z, t) = (137.517,16.5527,204.815,3403.09)
    Momentum (px, py, pz) = (-0.467529,1.17446,1243.1)
    Inittial Energy = 1243.1
    Deposit  Energy = 1098.56
    # Bounding Box  = 3
     Plane 0 (rows,cols) = (2160,672) ... Left Top (618,7806) ... Right Bottom (1290,5646)
     Plane 1 (rows,cols) = (2160,832) ... Left Top (709,7806) ... Right Bottom (1541,5646)
      Plane 2 (rows,cols) = (2160,1472) ... Left Top (670,7806) ... Right Bottom (2142,5646)
      [INFO]  <SimpleFiller::fill_entry_data::L320> Label to Datum: 1

What's in the ROOT file:

root [2] partroi_tpc_tree->Show(1783)
======> EVENT:1783
 partroi_tpc_branch = (larcv::EventROI*)0x4e8f630
 _producer       = tpc
 _run            = 5637
 _subrun         = 72
 _event          = 3610
 _part_v         = (vector<larcv::ROI>*)0x4e8f680
 _part_v._index  = 0, 1, 2
 _part_v._shape  = 2, 1, 1
 _part_v._type   = 2, 6, 9
 _part_v._mcst_index = 65535, 0, 1
 _part_v._mct_index = 0, 0, 0
 _part_v._energy_deposit = 271.893, 181.092, 90.801
 _part_v._energy_init = 414.253, 286.751, 1029.07
 _part_v._pdg    = 14, 13, 2212
 _part_v._parent_pdg = 0, 13, 2212
 _part_v._trackid = 4294967295, 1, 2
 _part_v._parent_trackid = 4294967295, 1, 2
 _part_v._vtx._x = 121.65, 121.65, 121.65

@twongjirad
Copy link
Member Author

twongjirad commented May 29, 2016

Oh shit! The Run,subrun,event numbers are different...

Something is not right ... I checked I am filling from same file I am checking with ROOT...

@twongjirad
Copy link
Member Author

twongjirad commented May 29, 2016

some notes:

use_thread = false, non-random: seems ok. it says it is processing entry X, and the ROI dumped out matches.

use_thread = true, non-random: seems ok

use_thread = true; random: weirdness

use_thread = false; random: weirdness

i'm relying on cout with threads -- dangerous? but it is single thread filling sequentially?

@twongjirad
Copy link
Member Author

there a double-shuffle?

In initializer of https://github.com/LArbys/LArCV/blob/master/core/Processor/ProcessDriver.cxx
the entries are shuffled.
if(_random_access) std::random_shuffle(_access_entry_v.begin(),_access_entry_v.end());

In https://github.com/LArbys/LArCV/blob/master/app/APICaffe/ThreadDatumFiller.cxx
_batch_process

the entry to be drawn is randomized between (0,numentries in tree)
This random draw, X, is stored.

But when it goes to process driver, this X is used to get entry Y = _access_entry_v[X].

X is stored in vector passed back to analysis.

So when training, correct label for an image is sent to net. but the wrong entry number for image-ROI pair is passed back to analysis script.

@twongjirad
Copy link
Member Author

Fixed in #36

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant