From 1dacdc45d97aa253f27842b0b6e9efe475677198 Mon Sep 17 00:00:00 2001 From: alpkabac Date: Sat, 29 Oct 2022 16:03:30 +0300 Subject: [PATCH] Fix venv not working --- .gitignore | 5 +++++ README.md | 3 ++- _tools/fewshot.py | 36 ++++++++++++++++++------------------ requirements.txt | 15 +++++++++++++++ 4 files changed, 40 insertions(+), 19 deletions(-) create mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore index bf6d7e2..901f2fe 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,7 @@ /.idea /__pycache__ +venv/ +_tools/disflow/opencv-4.2.0 +logs/ +*.mp4 +repo/magick-setup.exe diff --git a/README.md b/README.md index b82d445..bc980d6 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ python _tools\fewshot.py --W 1024 --H 512 --framegap 5 - --precision detailed + --precision detailed_flow ``` ### the terminal will pause after processing the frames and folders, you can then take the frames from the folder it tells you to take them from and apply a style to those and then export the frames to the folder it tells you, then press enter a couple times to resume the script :) @@ -93,6 +93,7 @@ pip install tensorflow==2.7.0 pip install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html pip install numpy==1.21.2 pip install moviepy +pip install numba ``` ### imagemagick install diff --git a/_tools/fewshot.py b/_tools/fewshot.py index 6c76ef0..65e0466 100644 --- a/_tools/fewshot.py +++ b/_tools/fewshot.py @@ -281,9 +281,9 @@ def video_to_frames(input_loc, output_loc): img = cv2.imread(imageread) print(img.shape) '''if( img.shape != (args.H, args.W, 3) ): - subprocess.run(["magick", "mogrify", "-resize", resizesize, "-quality", "100", gen_filtered_batch])#, "*.png", "-quality", "100", gen_filtered]) + subprocess.run(["magick", "mogrify", "-resize", resizesize, "-quality", "100", gen_filtered_batch])#, "*.png", "-quality", "100", gen_filtered], shell=True) print ("frames in ",gen_filtered, "resized") - subprocess.run(["magick", "mogrify", "-resize", resizesize, "-quality", "100", train_filtered_batch])#, "*.png", "-quality", "100", train_filtered]) + subprocess.run(["magick", "mogrify", "-resize", resizesize, "-quality", "100", train_filtered_batch])#, "*.png", "-quality", "100", train_filtered], shell=True) print ("frames in ",train_filtered, "resized") if( img.shape == (args.H, args.W, 3) ): print('no resizing needed')''' @@ -318,9 +318,9 @@ def video_to_frames(input_loc, output_loc): print("copy your previously chosen framenumbers but now in this folder = ",gen_mask2,"and put them in",train_mask) frowframe_run1 = (input("have your read the above and put your frames in the folder? press ENTER if you do")) else: - subprocess.run(['magick', 'mogrify', '-brightness-contrast', '200x0', '-path', gen_mask, '-format','png', gen_filtered_batch]) + subprocess.run(['magick', 'mogrify', '-brightness-contrast', '200x0', '-path', gen_mask, '-format','png', gen_filtered_batch], shell=True) print ("masks in " ,gen_mask, "made") - subprocess.run(['magick', 'mogrify', '-brightness-contrast', '200x0', '-path', train_mask, '-format','png', train_filtered_batch]) + subprocess.run(['magick', 'mogrify', '-brightness-contrast', '200x0', '-path', train_mask, '-format','png', train_filtered_batch], shell=True) print ("masks in " ,train_mask, "made") prjnm = str(args.projectname) @@ -377,25 +377,25 @@ def video_to_frames(input_loc, output_loc): if args.precision == 'detailed_flow': if args.framegap: if args.maskfile: - subprocess.run(['python', tools_all, '--projectname', prjnm, '--frames', video_length2, '--extension', 'png','--framegap', frmgp, '--precision', 'detailed_flow','--logpath',logpath,'--mask', '1']) + subprocess.run(['python', tools_all, '--projectname', prjnm, '--frames', video_length2, '--extension', 'png','--framegap', frmgp, '--precision', 'detailed_flow','--logpath',logpath,'--mask', '1'], shell=True) else: - subprocess.run(['python', tools_all, '--projectname', prjnm, '--frames', video_length2, '--extension', 'png','--framegap', frmgp, '--precision', 'detailed_flow','--logpath',logpath]) #add choice for precision and add '--export_path', args.export_path + subprocess.run(['python', tools_all, '--projectname', prjnm, '--frames', video_length2, '--extension', 'png','--framegap', frmgp, '--precision', 'detailed_flow','--logpath',logpath], shell=True) #add choice for precision and add '--export_path', args.export_path else: if args.maskfile: - subprocess.run(['python', tools_all, '--projectname', prjnm, '--frames', video_length2, '--extension', 'png', '--precision', 'detailed_flow','--logpath',logpath,'--mask', '1']) + subprocess.run(['python', tools_all, '--projectname', prjnm, '--frames', video_length2, '--extension', 'png', '--precision', 'detailed_flow','--logpath',logpath,'--mask', '1'], shell=True) else: - subprocess.run(['python', tools_all, '--projectname', prjnm, '--frames', video_length2, '--extension', 'png', '--precision', 'detailed_flow','--logpath',logpath]) #add choice for precision and add '--export_path', args.export_path + subprocess.run(['python', tools_all, '--projectname', prjnm, '--frames', video_length2, '--extension', 'png', '--precision', 'detailed_flow','--logpath',logpath], shell=True) #add choice for precision and add '--export_path', args.export_path elif args.precision == 'undetailed_flow': if args.framegap: if args.maskfile: - subprocess.run(['python', tools_all, '--projectname', prjnm, '--frames', video_length2, '--extension', 'png','--framegap', frmgp, '--precision', 'undetailed_flow','--logpath',logpath,'--mask', '1']) + subprocess.run(['python', tools_all, '--projectname', prjnm, '--frames', video_length2, '--extension', 'png','--framegap', frmgp, '--precision', 'undetailed_flow','--logpath',logpath,'--mask', '1'], shell=True) else: - subprocess.run(['python', tools_all, '--projectname', prjnm, '--frames', video_length2, '--extension', 'png','--framegap', frmgp, '--precision', 'undetailed_flow','--logpath',logpath]) #add choice for precision and add '--export_path', args.export_path + subprocess.run(['python', tools_all, '--projectname', prjnm, '--frames', video_length2, '--extension', 'png','--framegap', frmgp, '--precision', 'undetailed_flow','--logpath',logpath], shell=True) #add choice for precision and add '--export_path', args.export_path else: if args.maskfile: - subprocess.run(['python', tools_all, '--projectname', prjnm, '--frames', video_length2, '--extension', 'png', '--precision', 'undetailed_flow','--logpath',logpath,'--mask', '1']) + subprocess.run(['python', tools_all, '--projectname', prjnm, '--frames', video_length2, '--extension', 'png', '--precision', 'undetailed_flow','--logpath',logpath,'--mask', '1'], shell=True) else: - subprocess.run(['python', tools_all, '--projectname', prjnm, '--frames', video_length2, '--extension', 'png', '--precision', 'undetailed_flow','--logpath',logpath]) #add choice for precision and add '--export_path', args.export_path + subprocess.run(['python', tools_all, '--projectname', prjnm, '--frames', video_length2, '--extension', 'png', '--precision', 'undetailed_flow','--logpath',logpath], shell=True) #add choice for precision and add '--export_path', args.export_path else: print("webcam_test, normal, normal_slow don't use movement prediction, skipping..") @@ -417,7 +417,7 @@ def video_to_frames(input_loc, output_loc): #print(img1.shape) #print(args.H, args.W, "3") if( img1.shape != (args.H, args.W, 3) ): - subprocess.run(["magick","mogrify", "-resize", resizesize, "-quality", "100", train_output_batch]) # magick mogrify -resize 512x1024! -quality 100 C:\deepdream-test\Few-Shot-Patch-Based-Training-master\logs\kind_train\output/* + subprocess.run(["magick","mogrify", "-resize", resizesize, "-quality", "100", train_output_batch], shell=True) # magick mogrify -resize 512x1024! -quality 100 C:\deepdream-test\Few-Shot-Patch-Based-Training-master\logs\kind_train\output/* else: print("W and H are the same, skipping resize") if args.precision == 'detailed_flow': @@ -427,7 +427,7 @@ def video_to_frames(input_loc, output_loc): print('python', '-B', trainur, '--config', disco1010, '--data_root', train_root, '--log_interval', log_interval, '--log_folder', 'logs_reference_P','--projectname', prjnm,'--logpath',logpath) print("") print("") - subprocess.run(['python', '-B', trainur, '--config', disco1010, '--data_root', train_root, '--log_interval', log_interval, '--log_folder', 'logs_reference_P','--projectname', prjnm,'--logpath',logpath]) + subprocess.run(['python', '-B', trainur, '--config', disco1010, '--data_root', train_root, '--log_interval', log_interval, '--log_folder', 'logs_reference_P','--projectname', prjnm,'--logpath',logpath], shell=True) elif args.precision == 'webcam_test': print("results will appear in ",resppath,"every" ,log_interval,"steps") print("") @@ -435,7 +435,7 @@ def video_to_frames(input_loc, output_loc): print('python', '-B', trainur, '--config', webcam, '--data_root', train_root, '--log_interval', log_interval, '--log_folder', 'logs_reference_P','--projectname', prjnm,'--logpath',logpath) print("") print("") - subprocess.run(['python', '-B', trainur, '--config', webcam, '--data_root', train_root, '--log_interval', log_interval, '--log_folder', 'logs_reference_P','--projectname', prjnm,'--logpath',logpath]) + subprocess.run(['python', '-B', trainur, '--config', webcam, '--data_root', train_root, '--log_interval', log_interval, '--log_folder', 'logs_reference_P','--projectname', prjnm,'--logpath',logpath], shell=True) elif args.precision == 'undetailed_flow': print("results will appear in ",disco1015path,"every" ,log_interval,"steps") print("") @@ -443,7 +443,7 @@ def video_to_frames(input_loc, output_loc): print('python', '-B', trainur, '--config', disco1015, '--data_root', train_root, '--log_interval', log_interval, '--log_folder', 'logs_reference_P','--projectname', prjnm,'--logpath',logpath) print("") print("") - subprocess.run(['python', '-B', trainur, '--config', disco1015, '--data_root', train_root, '--log_interval', log_interval, '--log_folder', 'logs_reference_P','--projectname', prjnm,'--logpath',logpath]) + subprocess.run(['python', '-B', trainur, '--config', disco1015, '--data_root', train_root, '--log_interval', log_interval, '--log_folder', 'logs_reference_P','--projectname', prjnm,'--logpath',logpath], shell=True) elif args.precision == 'normal': print("results will appear in ",resppath,"every" ,log_interval,"steps") print("") @@ -451,7 +451,7 @@ def video_to_frames(input_loc, output_loc): print('python', '-B', trainur, '--config', normal, '--data_root', train_root, '--log_interval', log_interval, '--log_folder', 'logs_reference_P','--projectname', prjnm,'--logpath',logpath) print("") print("") - subprocess.run(['python', '-B', trainur, '--config', normal, '--data_root', train_root, '--log_interval', log_interval, '--log_folder', 'logs_reference_P','--projectname', prjnm,'--logpath',logpath]) + subprocess.run(['python', '-B', trainur, '--config', normal, '--data_root', train_root, '--log_interval', log_interval, '--log_folder', 'logs_reference_P','--projectname', prjnm,'--logpath',logpath], shell=True) elif args.precision == 'normal_slow': print("results will appear in ",resfpath,"every" ,log_interval,"steps") print("") @@ -459,5 +459,5 @@ def video_to_frames(input_loc, output_loc): print('python', '-B', trainur, '--config', normal2, '--data_root', train_root, '--log_interval', log_interval, '--log_folder', 'logs_reference_P','--projectname', prjnm,'--logpath',logpath) print("") print("") - subprocess.run(['python', '-B', trainur, '--config', normal2, '--data_root', train_root, '--log_interval', log_interval, '--log_folder', 'logs_reference_P','--projectname', prjnm,'--logpath',logpath]) + subprocess.run(['python', '-B', trainur, '--config', normal2, '--data_root', train_root, '--log_interval', log_interval, '--log_folder', 'logs_reference_P','--projectname', prjnm,'--logpath',logpath], shell=True) \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..be3ee57 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,15 @@ +ruamel.yaml +pysimplegui +Gooey +opencv-python +scikit-build +cython +Pillow +PyYAML==5.4 +scikit-image==0.18.1 +scipy==1.6.2 +tensorflow==2.7.0 +torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html +numpy==1.21.2 +moviepy +numba \ No newline at end of file