Helias / Car-Model-Recognition

Car Model Recognition project
74 stars 19 forks source link

while training #9

Closed DharunBoominathan closed 6 months ago

DharunBoominathan commented 7 months ago

RuntimeError: An attempt has been made to start a new process before the current process has finished its bootstrapping phase.

    This probably means that you are not using fork to start your
    child processes and you have forgotten to use the proper idiom
    in the main module:

        if __name__ == '__main__':
            freeze_support()
            ...

    The "freeze_support()" line can be omitted if the program
    is not going to be frozen to produce an executable.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 1, in File "C:\Users\PRADEEP\AppData\Local\Programs\Python\Python310\lib\multiprocessing\spawn.py", line 116, in spawn_main exitcode = _main(fd, parent_sentinel) File "C:\Users\PRADEEP\AppData\Local\Programs\Python\Python310\lib\multiprocessing\spawn.py", line 125, in _main prepare(preparation_data) File "C:\Users\PRADEEP\AppData\Local\Programs\Python\Python310\lib\multiprocessing\spawn.py", line 236, in prepare _fixup_main_from_path(data['init_main_from_path']) File "C:\Users\PRADEEP\AppData\Local\Programs\Python\Python310\lib\multiprocessing\spawn.py", line 287, in _fixup_main_from_path main_content = runpy.run_path(main_path, File "C:\Users\PRADEEP\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 269, in run_path return _run_module_code(code, init_globals, run_name, File "C:\Users\PRADEEP\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 96, in _run_module_code _run_code(code, mod_globals, init_globals, File "C:\Users\PRADEEP\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code exec(code, run_globals) File "C:\Users\PRADEEP\Downloads\Car-Model-Recognition-master\Car-Model-Recognition-master\main.py", line 228, in train_model_iter("resnet152", resnet152_model) File "C:\Users\PRADEEP\Downloads\Car-Model-Recognition-master\Car-Model-Recognition-master\main.py", line 216, in train_model_iter model, loss_acc, y_testing, preds = train_model(model_name=model_name, model=model, weight_decay=weight_decay) File "C:\Users\PRADEEP\Downloads\Car-Model-Recognition-master\Car-Model-Recognition-master\main.py", line 122, in train_model print (batch['img_name']) UnboundLocalError: local variable 'batch' referenced before assignment

Helias commented 7 months ago

if you want to use multiple process at the same time, I recommend you to use the threading python library or other similar one if you really need to have multiple process you could use pathos library or subprocess or multiprocessing (keep in mind that pathos is kind a wrapper of multiprocessing library IIRC)

I can't help you having no context or code about your error