Jan-05-2021, 12:56 PM
I am using the following function:
more specifically, the error is in int(row[1]) i,e problem of converting string to int.
def load_target_class(input_dir): """Loads target classes.""" with tf.gfile.Open(os.path.join(input_dir, 'target_class.csv')) as f: return {row[0]: int(row[1]) for row in csv.reader(f) if len(row) >= 2}For example, target_class.csv contains the following two colomns:
1,"tench, Tinca tinca" 2,"goldfish, Carassius auratus" 3,"great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias" 4,"tiger shark, Galeocerdo cuvieri" 5,"hammerhead, hammerhead shark" 6,"electric ray, crampfish, numbfish, torpedo" 7,stingray 8,cockThe output error is:
ValueError: invalid literal for int() with base 10: 'tench, Tinca tinca'How can I deal with this error?
more specifically, the error is in int(row[1]) i,e problem of converting string to int.