original_docstring: Evaluates the square counting method on the full data
docstring: Evaluates the square counting method on the full data
docstring_tokens: Evaluates the square counting method on the full data
code: def eval_cv():
      "Evaluates the square counting method on the full data"
      # read in the full data
      df_all = pd.read_csv("data/all.csv")
      # make arrays to store the data
      y_pred, y_true = [0]*len(df_all), [0]*len(df_all)
      print("Evaluating OpenCV method")
      for index, row in tqdm(df_all.iterrows(), total=len(df_all)):
          # save the true value
          true = row["target"]
          y_true[index] = true
          # where the image is located
          f_name = row["filename"]
          image_loc = os.path.join(config.RAW_DIR, f_name)
          # load the image
          image = cv.imread(image_loc)
          # save the openCV prediction
          pred = n_squares(image)
          y_pred[index] = pred
      # return the result
      return precision_score(y_true, y_pred, average="micro")
code_tokens: def eval_cv ( ) : df_all = pd . read_csv ( "data/all.csv" ) y_pred , y_true = [ 0 ] * len ( df_all ) , [ 0 ] * len ( df_all ) print ( "Evaluating OpenCV method" ) for index , row in tqdm ( df_all . iterrows ( ) , total = len ( df_all ) ) : true = row [ "target" ] y_true [ index ] = true f_name = row [ "filename" ] image_loc = os . path . join ( config . RAW_DIR , f_name ) image = cv . imread ( image_loc ) pred = n_squares ( image ) y_pred [ index ] = pred return precision_score ( y_true , y_pred , average = "micro" )
short_docstring: Evaluates the square counting method on the full data
short_docstring_tokens: Evaluates the square counting method on the full data
comment: "Evaluates the square counting method on the full data"$SEP$# read in the full data$SEP$# make arrays to store the data$SEP$# save the true value$SEP$# where the image is located$SEP$# load the image$SEP$# save the openCV prediction$SEP$# return the result