Skip to content

Commit

Permalink
Merge pull request #1 from alpkabac/master
Browse files Browse the repository at this point in the history
Fix venv not working
  • Loading branch information
nicolai256 authored Oct 29, 2022
2 parents 4d99eb5 + 1dacdc4 commit 9211884
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 19 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
/.idea
/__pycache__
venv/
_tools/disflow/opencv-4.2.0
logs/
*.mp4
repo/magick-setup.exe
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 :)

Expand Down Expand Up @@ -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
Expand Down
36 changes: 18 additions & 18 deletions _tools/fewshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')'''
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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..")

Expand All @@ -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':
Expand All @@ -427,37 +427,37 @@ 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("")
print("")
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("")
print("")
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("")
print("")
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("")
print("")
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)

15 changes: 15 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 9211884

Please sign in to comment.