Skip to content

LinShanify/CMC

Repository files navigation

A Simple Tool for Ploting CMC Curve

CMC Class: 3 Inputs (1 required, 2 optinal)

  1. cmc_dict: python dictionary of cmc values. Key is the method name (string). Value is the cmc values.
    • The last dictionary item must be set to your proposed method's result.
cmc_dict ={
    'SDALF': [0.10, 0.21, 0.29, 0.34, 0.40, 0.44, 0.47, 0.51, 0.54, 0.57],
    'ImprovedReID': [0.65, 0.75, 0.81, 0.85, 0.89, 0.90, 0.91, 0.91, 0.93, 0.94],
    'Proposed Method': [0.65, 0.75, 0.81, 0.85, 0.89, 0.90, 0.91, 0.91, 0.93, 0.94]
}
  1. color (optional): a list of colors for ploting (the first color will be used for your proposed method's cmc curve). detail document for color is here
    • 7 default colors is alrady set up in the class: color = ['r','g','b','c','m','y','orange','brown']
  2. marker (optional): a list of markers for ploting (the first marker will be used for your proposed method's cmc curve). detail document for marker is here.
    • 7 default marker is alrady set up in the class: marker = ['*','o','s','v','X','*','.','P']
from CMC import CMC
cmc = CMC(cmc_dict)

#custimised color and marker
new_color = ['r','g','b','c','m','y','orange','brown']
new_marker = ['*','o','s','v','X','*','.','P']
cmc = CMC(cmc_dict,color=new_color,marker=new_marker)

Method 1 plot: 1 required, 4 optional

  1. title: title of the cmc curve (string)
  2. rank(optional): top n value for ploting (integer), default is 20
  3. xlabel (optional): label for x-axis (string), default is Rank
  4. ylabel (optional): label for y-axis (sting). default is Matching Rates (%)
  5. show_grid (optional): turn on or off grid in the graph (boolean). default is True
#simple plot
cmc.plot(title = 'CMC on CUHK01 (100 test IDs)')

png

#custimised color and marker
cmc.plot(title = 'CMC on CUHK01', rank=10,
         xlabel='Rank Score',
         ylabel='Recognition Rate', show_grid=False)

png

Method 2 save: 2 required, 6+ optional

Required

  1. title: title of the cmc curve (string)
  2. filename: filename for saved figure (string)

Optional

  1. rank(optional): top n value for ploting (integer), default is 20
  2. xlabel (optional): label for x-axis (string), default is Rank
  3. ylabel (optional): label for y-axis (sting). default is Matching Rates (%)
  4. show_grid (optional): turn on or off grid in the graph (boolean). default is True
  5. save_path (optional): figure saving directory (default is the current working directory)
  6. format (optional): figure saving fomate (jpg, jpeg, png, pdf, ps, eps and svg), default is png
  7. other parameters from pyplot.savefig can be used here
# simple save
cmc.save(title = 'CMC on CUHK01 (100 test IDs)', filename='cmc_result_1')
#custimised save
cmc.save(title = 'CMC on CUHK01', filename='cmc_result_2',
         rank=10,xlabel='Rank Score', ylabel='Recognition Rate', 
         show_grid=False, format='png')

About

A Tool for Ploting CMC Curve

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages