(type, X, clean_index, noisy_index, save_path='')
| 183 | for param in net.parameters(): |
| 184 | param.requires_grad = requires_grad |
| 185 | def plot_pair_distribution(type, X, clean_index, noisy_index, save_path=''): |
| 186 | plt.clf() |
| 187 | ax = plt.gca() |
| 188 | |
| 189 | font1 = {'family': 'Times New Roman', |
| 190 | 'weight': 'normal', |
| 191 | 'size': 13, |
| 192 | } |
| 193 | |
| 194 | # Plot data histogram |
| 195 | if type == 0: |
| 196 | ax.hist(X[clean_index], bins=100, density=True, histtype='stepfilled', color='darkorchid', alpha=0.3, |
| 197 | label='True Pos. Pairs') |
| 198 | ax.hist(X[noisy_index], bins=100, density=True, histtype='stepfilled', color='blue', alpha=0.3, |
| 199 | label='False Pos. Pairs') |
| 200 | if type == 1: |
| 201 | ax.hist(X[clean_index], bins=100, density=True, histtype='stepfilled', color='teal', alpha=0.3, |
| 202 | label='True Neg. Pairs') |
| 203 | ax.hist(X[noisy_index], bins=100, density=True, histtype='stepfilled', color='peru', alpha=0.3, |
| 204 | label='False Neg. Pairs') |
| 205 | |
| 206 | ax.set_xlabel('Normalized Distances', fontdict=font1) |
| 207 | ax.set_ylabel('Frequency', fontdict=font1) |
| 208 | x_ticks = np.array([0.0, 0.2, 0.4, 0.6, 0.8, 1.0]) |
| 209 | plt.xticks(x_ticks) |
| 210 | plt.tick_params(labelsize=11) |
| 211 | ax.legend(loc='upper left', prop=font1) |
| 212 | |
| 213 | if save_path: |
| 214 | plt.savefig(save_path, dpi=300) |
| 215 | else: |
| 216 | plt.show() |
| 217 | |
| 218 | class AllSampler(Sampler): |
| 219 | def __init__(self, dataset, train_color_label, train_thermal_label, shuffle=True): |
nothing calls this directly
no outgoing calls
no test coverage detected