Solved by ptrblck in post #4 
              
              
                Based on the output it seems that the working iterations are creating the label initially as a str and in the conditions are replacing it with an int: 
        print("data_path label",type(label)) #label type : str
        if label.startswith("Black"):
            label=0
        elif label.startswi…