original_docstring:  Plot the regularity scores across all frames
      
docstring: Plot the regularity scores across all frames
docstring_tokens: Plot the regularity scores across all frames
code: def plot_regularity_score(video_root_path, dataset, videoid, logger, score_vid):
      """ Plot the regularity scores across all frames
      """
      import os
      import numpy as np
      import matplotlib.pyplot as plt
      
      save_path = os.path.join(video_root_path,dataset,'regularity_plots')
      os.makedirs(save_path, exist_ok=True)  
      
      logger.debug("Plotting regularity scores")
      plt.figure(figsize=(10, 3))
      ax = plt.subplot(111)
      box = ax.get_position()
      ax.set_position([box.x0, box.y0 + box.height*0.1, box.width, box.height*0.9])
      ax.plot(np.arange(1, len(score_vid)+1), score_vid, color='b', linewidth=2.0)
      plt.xlabel('Frame Number')
      plt.ylabel('Regularity score')
      plt.ylim(0, 1)
      plt.xlim(1, len(score_vid)+1)
      #ax.hlines(y=0.5, xmin=0, xmax=len(score_vid)+1, linewidth=1, color='r')
  
      vid_raw = get_gt_range(video_root_path,dataset, videoid)
      for event in vid_raw:
          plt.fill_between(np.arange(event[0], event[1]), 0, 1, facecolor='green', alpha=0.4)
  
      plt.savefig(os.path.join(save_path,'scores_{0}_video_{1:02d}.png'.format(dataset, videoid+1)), dpi=300)
      plt.close()
code_tokens: def plot_regularity_score ( video_root_path , dataset , videoid , logger , score_vid ) : import os import numpy as np import matplotlib . pyplot as plt save_path = os . path . join ( video_root_path , dataset , 'regularity_plots' ) os . makedirs ( save_path , exist_ok = True ) logger . debug ( "Plotting regularity scores" ) plt . figure ( figsize = ( 10 , 3 ) ) ax = plt . subplot ( 111 ) box = ax . get_position ( ) ax . set_position ( [ box . x0 , box . y0 + box . height * 0.1 , box . width , box . height * 0.9 ] ) ax . plot ( np . arange ( 1 , len ( score_vid ) + 1 ) , score_vid , color = 'b' , linewidth = 2.0 ) plt . xlabel ( 'Frame Number' ) plt . ylabel ( 'Regularity score' ) plt . ylim ( 0 , 1 ) plt . xlim ( 1 , len ( score_vid ) + 1 ) vid_raw = get_gt_range ( video_root_path , dataset , videoid ) for event in vid_raw : plt . fill_between ( np . arange ( event [ 0 ] , event [ 1 ] ) , 0 , 1 , facecolor = 'green' , alpha = 0.4 ) plt . savefig ( os . path . join ( save_path , 'scores_{0}_video_{1:02d}.png' . format ( dataset , videoid + 1 ) ) , dpi = 300 ) plt . close ( )
short_docstring: Plot the regularity scores across all frames
short_docstring_tokens: Plot the regularity scores across all frames
comment: """ Plot the regularity scores across all frames
      """$SEP$#ax.hlines(y=0.5, xmin=0, xmax=len(score_vid)+1, linewidth=1, color='r')