<jupyter_start><jupyter_text>CPU VS GPU<jupyter_code>names = ['hrnetv2\nc1', 'mobilenetv2dilated\nc1_deepsup', 'resnet101dilated\nppm_deepsup', 'resnet101\nupernet', 
        'resnet18dilated\nppm_deepsup', 'resnet50dilated\nppm_deepsup', 'resnet50\nupernet']

gpu_load_time = [0.8317041119998976, 0.08185544600019057, 0.9722921249995125, 1.1342338739996194, 0.3433740279997437, 
                 0.7033942389998629, 0.8720066390005741]
gpu_time = [0.6584389950003242, 0.3087233969999943, 1.1439642240002286, 0, 0.5229989019999266, 
            0.8730596940004034, 0]

cpu_load_time = [0.8361522599998352, 0.08521515199936402, 1.0185269150006206, 1.2080746639994686, 0.3453997340002388, 
                0.7113769529996716, 0.8756012989997544]
cpu_time = [7.313980812999944, 3.6011879489997227, 17.61367605199939, 15.324996708000072, 7.795829454000341, 
           13.314744125000288, 14.013098361999255]
x = np.arange(len(names))  # the label locations
width = 0.35  # the width of the bars

fig, ax = plt.subplots(figsize=(15, 10))
rects1 = plt.bar(x - width/2, gpu_load_time, width, label='GPU: RTX 2060 6GB', alpha=0.65)
rects2 = plt.bar(x + width/2, cpu_load_time, width, label='CPU: i7-9750H', alpha=0.65)

text_ph = 0.006
for i, v in enumerate(cpu_load_time):
    if v==0:
        ax.text(i-width+width/4, v+text_ph, "error", color='red', fontsize=12)
    else:
        ax.text(i+width/4, v+text_ph, "{:.2f}".format(v), color='blue', fontsize=12)
    
for i, v in enumerate(gpu_load_time):
    if v==0:
        ax.text(i-width+width/4, v+text_ph, "error", color='red', fontsize=12)
    else:
        ax.text(i-width+width/4, v+text_ph, "{:.2f}".format(v), color='red', fontsize=12)

# Add some text for labels, title and custom x-axis tick labels, etc.
ax.set_ylabel('Time (Second)', fontsize=15, fontweight='bold')
# ax.set_xlabel('Models', fontsize=15)
ax.set_title('GPU vs CPU (Model Load Time)', fontsize=20)
ax.set_xticks(x)
ax.set_xticklabels(names, fontsize=12, fontweight='bold')
# ax.tick_params(labelrotation=0, labelsize='large')
ax.legend(fontsize=15)

fig.tight_layout()

plt.show()
x = np.arange(len(names))  # the label locations
width = 0.35  # the width of the bars

fig, ax = plt.subplots(figsize=(15, 10))
rects1 = plt.bar(x - width/2, gpu_time, width, label='GPU: RTX 2060 6GB', alpha=0.65)
rects2 = plt.bar(x + width/2, cpu_time, width, label='CPU: i7-9750H', alpha=0.65)

text_ph = 0.05
for i, v in enumerate(cpu_time):
    if v==0:
        ax.text(i-width+width/4, v+text_ph, "error", color='red', fontsize=12)
    else:
        ax.text(i+width/4, v+text_ph, "{:.2f}".format(v), color='blue', fontsize=12)
    
for i, v in enumerate(gpu_time):
    if v==0:
        ax.text(i-width+width/4, v+text_ph, "error", color='red', fontsize=12)
    else:
        ax.text(i-width+width/4, v+text_ph, "{:.2f}".format(v), color='red', fontsize=12)

# Add some text for labels, title and custom x-axis tick labels, etc.
ax.set_ylabel('Time (Second)', fontsize=15, fontweight='bold')
# ax.set_xlabel('Models', fontsize=15)
ax.set_title('GPU vs CPU (Inference Time)', fontsize=20)
ax.set_xticks(x)
ax.set_xticklabels(names, fontsize=12, fontweight='bold')
# ax.tick_params(labelrotation=0, labelsize='large')
ax.legend(fontsize=15)

fig.tight_layout()

plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16203143893591293, 'fraction_numerical': 0.1735187424425635, 'mean_word_length': 4.666095890410959, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '657507', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 1724, 'n_tokens_neox': 1378, 'n_words': 253, 'path': 'notebooks/plot.ipynb', 'repo_name': 'zyang37/semantic-segmentation-pytorch', 'size': '3308'}