Closed shivahanifi closed 1 day ago
For the background class (0,feature,bckgnd,Black,0,0,0,0) while it shows the 0.89054837 class_wise_IU
there is no color black appearing in the predicted frames.
class_wise_IU
is correlated with the labels in /SCDD-image-segmentation-keras/share/SCDD_20211104/ListOfClassesAndColorCodes_20211104.csv
The problem was with the code not attributing the correct color codes to labels( found by tracking back up to visualize_segmentation
function). Solved by making it read them through the provided `share/SCDD_20211104/ListOfClassesAndColorCodes_20211104.csv' file.
# CSV file for classes
csv_path = "/SCDD-image-segmentation-keras/share/SCDD_20211104/ListOfClassesAndColorCodes_20211104.csv"
df = pd.read_csv(csv_path)
colors = df[['Red', 'Green','Blue']].apply(lambda x: (x['Red'], x['Green'], x['Blue']), axis=1).tolist()
class_names = df['Desc'].tolist()
wandb.config.colors = colors
wandb.config.labels_Desc = class_names
The color code is used in the predict function. Also a legend is attached for better visualization.
# Predict segmentation
predictions = model.predict_multiple(
inp_dir=test_image_path,
out_dir=prediction_output_dir,
class_names=class_names,
show_legends=True,
colors=colors,
)
For the models trained on
dataset_20211104
the model detects all the background as the21,feature,frame edge,Aqua marine,127,255,215,212