Closed shaded3d closed 6 years ago
Have you run the script to the point where it placed jpgs into your 1_output folder?
Are there photos in that folder?
'i' is the path name of each photo in your 1_output folder. 'i' scans through the photos.
No, I run it with the command python demo.py -i 'face.jpg' -v 'video dir' and that is the next thing that pops up.
I'm not sure what the problem is because 'random_string' is defined on line 91.
But you're getting 'NameError: name 'random_string' is not defined'
Okay, could you explain what is -h?
I don't know what '-h' is. Where are you seeing '-h'?
Do this in your terminal. Go into python3... $python 3
import random
import string
def random_string(length):
return ''.join(random.choice(string.ascii_letters) for m in range(length))
print (random_string(10))
paste all that code into your python3 '>>>' command line.
What's that do?
Does it print 10 random letters or give an error?
It gives me 10 letters.
I'm not sure what the problem could be because the script defines 'random_string'.
I have to fish for the problem Are you running the script in an env with the dependancies installed with python3? Are your videos .mp4s?
Seems like just putting one video made it work. Might be an issue handling several large mp4s?
"Seems like" like you're getting it to work with one video?
I have a dir of 66, 1080p mp4s and it rips through them without any problems.
It randomly selects an mp4, scans it, then moves it when it's done so it doesn't scan it again, and randomly grabs the next mp4.
Different systems have different problems getting the depencies running though.
Do all the depancies work on your system? Have you installed and tested the face_recognition package?
Running the script seems a bit slow, not "ripping through" like you say. It's checking about 2 frames per second. Could this mean I installed the dlib wrong? It should be using the GPU, right?
Glad to hear it's working.
Do you have an Nvidia GPU? A serious GPU you bought seperate and not a basic GPU that came with the computer?
If so type
nvidia-smi
in the Terminal when the script is running.
It should display that python is using lots of GPU memory.
If you have a heavy duty GPU you bought you can probably run the dlib install instructions in the readme without trying to uninstall anything and that should get your GPU running.
I once tried installing CUDA for the Nvidia GPU in my iMac but it caused the system to crash all the time.
I have a 1080ti and it takes a few minutes to pull 500 found faces from a video. Maybe "rip" isn't the operative adjective but much faster and easier than doing it yourself.
I plan on getting a Titan V soon if I don't hear of something better coming out.
I can't run this command. I'm on Windows 10, by the way. Task manager is showing that cpu is at 23% and gpu roughly 8%. It's a 1060. I already ran the gpu-specific commands from the readme also.
Seems like it's hardly using the gpu at all now. I will look into the dlib again.
Yeah, you have the GPU power you are not, and def want to be using.
I haven't touched a PC in ten years so I don't know if the install is different than my install instructions for dlib I put in the readme.
Let me know if it works or if I should put a note to do something different for a PC.
I'm sure you will find support for getting dlib and face_recognition to utilize the GPU online. Most people have PCs.
This issue is reduced to your GPU working with the dependencies so I'm closing.
@MotorCityCobra I'm getting the same issue as @shaded3d, but only using one video instead of a group of them didn't fix the problem for me.
You're the third or fourth person to have this problem. I never hear back if anyone gets around it.
There's something wrong with the for loop on line 68.
It just dawned on me that it might be because I used 'i' in three different for loops.
I just changed them all to be unique in the repo if you want to grab the 'demo.py' file again.
If that doesn't work try replacing the for look on 68 with these two lines...
vid = True
while(vid):
@MotorCityCobra Pulling your edits didn't work unfortunately.
You want me to replace the entire loop with those two lines, or replace vid = random.choice(glob.glob(vid_dir + '*.mp4'))
with vid = True
and add while(vid):
above print("Now looking at video: " + vid)
?
Darn.
No, don't change that much. Just two tiny lines replace the one line 'for i in range(200):'
I changed it in the repo if you want to pull from there again and try it.
Oh right, my bad. I'm not getting the error any more which is good, but It seems to be stuck after
[ INFO:0] Initialize OpenCL runtime...
Using OpenCL: True.
Output directory: /example/Photo/pic_output.
Scanned videos will be moved to: /example/Photo/pic_scanned_vids.
It's been hanging there for ~5 minutes but I guess it could just be taking a while to load? Is there supposed to be a progress bar or something? There's nothing in my output folders yet, but it created the folders successfully
hmmm. You should be getting more on the screen than that.
It looks like the script has stopped near that same problem area on 67/68.
Your target image gets loaded right before that. Do you want to put...
print ("Target image loaded" + target_image)
under line 63 (on line 64) and tell me if it printed?
Now it's spitting this out:
Traceback (most recent call last):
File "demo.py", line 64, in <module>
print ("Target image loaded" + target_image)
TypeError: ufunc 'add' did not contain a loop with signature matching types dtype('<U19') dtype('<U19') dtype('<U19')
Try replacing print ("Target image loaded" + target_image) with print ("Target image loaded" + str(target_image))
So close! It started loading images but it froze after a few lines:
[ INFO:0] Initialize OpenCL runtime...
Using OpenCL: True.
Output directory: /Users/lars.field/Documents/Development/deep/sets/Rachel Weisz/Photo/pic_output.
Scanned videos will be moved to: /Users/lars.field/Documents/Development/deep/sets/Rachel Weisz/Photo/pic_scanned_vids.
Target image loaded[[[222 228 216]
[219 225 213]
[209 215 203]
...
[170 183 189]
[167 180 186]
[164 177 183]]
[[180 185 178]
[179 184 177]
[172 177 170]
...
[170 183 189]
[168 181 187]
[166 179 185]]
[[152 158 156]
[154 160 158]
[150 156 154]
...
[167 180 186]
[166 179 185]
[165 178 184]]
...
[[ 54 55 59]
[ 54 55 59]
[ 54 55 59]
...
[107 124 140]
[107 124 140]
[ 96 113 129]]
[[ 54 55 59]
[ 54 55 59]
[ 55 56 60]
...
[111 128 144]
[109 126 142]
[ 96 113 129]]
[[ 54 55 59]
[ 55 56 60]
[ 56 57 61]
...
[113 130 146]
[110 127 143]
[ 95 112 128]]]
Nothing appearing in the output folders either
Well, we can cross that part of the script off the list as not being the problem.
Are you using a virtual environment?
I know this will be time consuming but I'm pretty much stumped here.
If you are running this in a conda environment could you re-install all the dependencies in a virtualenv environment, or vice versa?
I'm just two years into programming, so no expert, but I've never seen a script have such a inexplicable problem with one part.
I wasn't using a virtual environment, but I'll give virtualenv a go. Might take a while :'(
This must be a problem with whatever version of python you're using and some package, right?
is it 3.6?
I don't see how python can just not read a while loop or for loop.
I've been using 2.7.1, should I have been using 3.6? :S
Yes. Try 3. Anything that you can install with pip install with pip3 install some_package
and when you're finally ready to run the script again try running it with $python3, python3.4, python3.5, python3.6 until one, hopefully, works.
Did you try running it with, $python3, python3.4, python3.5, python3.6 In the environment you were trying to run it in earlier?
Yep, but I was getting the same errors. I'll try 3 and report back
Maybe you could put the whole script, up to, and including that 'while' loop on StackOverflow and see if those geniuses know what's wrong with it.
Tried it with python3. It's still printing the same thing out and then freezing, just with different numbers :(
@MotorCityCobra Have you heard from anyone who's managed to get the script working successfully? Trying to figure out if, besides yourself, it's working for some but not for others
Bummer
Haven't heard from anyone after having this problem, no.
I figured Stack Overflow might be able to help. I would ask them but I don't have the problem so can't debug. It scrapes just fine for me.
I got this script from this script. Try the original. https://github.com/Tyrannosaurus1234/GetFaces
@MotorCityCobra I posted a thread on stackexchange, if anything comes of it I'll let you know. The original GetFaces script works fine for me, so I guess whatever's broken is in the faceripper9000 script.
@MotorCityCobra Got a response
"Why do you define random_string(length)
in the while loop???? Take it outside of the loop. As a side note, your try/except
block is way broad."
I love stack exchange but there's a lot of condescending people hanging around there
I was just looking at that and came here to github to see if I, and/ or Teranisourus1234 did that.
I see that's how I had it in the repo.
So, did that fix it?
Nope, still just printing out arrays of numbers :(
That array of numbers is just from the learned, target image. So it's grabbing that Okay.
I think we tried a variation of this already outside of the script but can you put this above the while loop and the 'vid = True' on line 71?
vid = random.choice(glob.glob(vid_dir + '*.mp4'))
print (vid_dir)
print ("Now looking at video: " + vid)
So if you inserted this in the current demp.py on line 71 (not indented in or under anything) it should be after the random_string function and before the while loop and the vid = True lines.
What does this print out for you in the Terminal?
Run it multiple times. Does it grab a different mp4 each time? Your videos are mp4s?
Closing.
Check that the script is grabbing random mp4s in your video dir by adding to the script if you have this problem.
vid = random.choice(glob.glob(vid_dir + '*.mp4'))
print (vid_dir)
print ("Now looking at video: " + vid)
Didn't mean to duck out, just got busy. Seems to have fixed this particular issue though :) Nice work 👍
File "demo.py", line 161, in
os.rename(i, too_small + "/too small-" + str(counter) + random_string(15) + ".jpg")
NameError: name 'random_string' is not defined
What could be the problem here? What is -i?