thtrieu / darkflow

Translate darknet to tensorflow. Load trained weights, retrain/fine-tune using tensorflow, export constant graph def to mobile devices
GNU General Public License v3.0
6.13k stars 2.08k forks source link

NameError: name 'exit' is not defined, tf.train #1039

Open HarishDechiraju opened 5 years ago

HarishDechiraju commented 5 years ago

Trying out an object detection video similar to this GitHub out here https://github.com/deep-diver/Soccer-Ball-Detection-YOLOv2/blob/master/YOLOv2-Train.ipynb

But when I run tf.train()

I get this error

NameError Traceback (most recent call last)

in ----> 1 tfnet.train() ~/darkflow/darkflow/net/flow.py in train(self) 38 loss_op = self.framework.loss 39 ---> 40 for i, (x_batch, datum) in enumerate(batches): 41 if not i: self.say(train_stats.format( 42 self.FLAGS.lr, self.FLAGS.batch, ~/darkflow/darkflow/net/yolo/data.py in shuffle(self) 95 def shuffle(self): 96 batch = self.FLAGS.batch ---> 97 data = self.parse() 98 size = len(data) 99 ~/darkflow/darkflow/net/yolo/data.py in parse(self, exclusive) 14 if not os.path.isdir(ann): 15 msg = 'Annotation directory not found {} .' ---> 16 exit('Error: {}'.format(msg.format(ann))) 17 print('\n{} parsing {}'.format(meta['model'], ann)) 18 dumps = pascal_voc_clean_xml(ann, meta['labels'], exclusive) NameError: name 'exit' is not Any solution to this?
kmarrip commented 5 years ago

@HarishDechiraju i got the exact same error for a while in colab, the thing is while building the model using " pip3 install -e ." make sure u are doing it on same directory, dont just copy the entire directory are building it build it on the go

danjmp commented 5 years ago

Hi guys, I am having the same error and I have done whar @krishna223412 said, however it is still not working.

Has someone any tip for this?

Cheers

Debangsha1992 commented 4 years ago

So the problem is in /darkflow/utils/process.py. Apparently sys package has the exit() method and it is not in-built in Python(at least not in the latest version of Python 3).

So in process.py add:

from sys import exit

kritika-joshi commented 4 years ago

I did what @Debangsha1992 said but this is still not working for me... Any other ideas?