MCPcopy Create free account
hub / github.com/PeizeSun/SparseR-CNN / update_stats

Method update_stats

detectron2/engine/hooks.py:412–436  ·  view source on GitHub ↗

Update the model with precise statistics. Users can manually call this method.

(self)

Source from the content-addressed store, hash-verified

410 self.update_stats()
411
412 def update_stats(self):
413 """
414 Update the model with precise statistics. Users can manually call this method.
415 """
416 if self._disabled:
417 return
418
419 if self._data_iter is None:
420 self._data_iter = iter(self._data_loader)
421
422 def data_loader():
423 for num_iter in itertools.count(1):
424 if num_iter % 100 == 0:
425 self._logger.info(
426 "Running precise-BN ... {}/{} iterations.".format(num_iter, self._num_iter)
427 )
428 # This way we can reuse the same iterator
429 yield next(self._data_iter)
430
431 with EventStorage(): # capture events in a new storage to discard them
432 self._logger.info(
433 "Running precise-BN for {} iterations... ".format(self._num_iter)
434 + "Note that this could produce different statistics every time."
435 )
436 update_bn_stats(self._model, data_loader(), self._num_iter)

Callers 1

after_stepMethod · 0.95

Calls 1

EventStorageClass · 0.90

Tested by

no test coverage detected