scanner-research / scanner

Efficient video analysis at scale
https://scanner-research.github.io/
Apache License 2.0
620 stars 108 forks source link

General queries #204

Closed msharmavikram closed 6 years ago

msharmavikram commented 6 years ago

I have been going over the example and trying out scanner today. I have noticed some issues in examples and trying some hacks to fix it. I think its best if I bring this to your attention.

  1. scannerpy.stdlib does not have parsers anymore. Many examples still use parsers. This needs to be converted to readers

  2. It would be great if you can provide minimum GPU requirement. I downloaded the sample-clip.mp4 and ran shot_detect.py example. The video clip is about 34MB and my GPU has about 4GB of memory. Turns out I ran out of memory in no time. Appreciate if you can provide some insight on minimum configuration to use GPU/CPU.

  3. Could you please provide some documentation on how to run reverse_image_search example? There are two files - server and search. However, both internally use datasets that are not available to the public (probably as it had hard paths encoded). I am not sure how should I run it too. What I did have I hosted the server first and then tried running the search with a few sample images. But yeah, that did not work as I expected it to be! I will be happy if you can help me figure this out as my primary intention to use the scanner is to do an image search or frame search in the video.

fpoms commented 6 years ago

First, thanks for taking the time to provide feedback! I've already fixed issue 1 you brought up.

  1. If you want to get the shot detection example working right away, you can switch the code to use CPUs instead of GPUs by changing L82 from if db.has_gpu(): to if False:. As for the memory requirements, this is largely dictated by the size of the work packets that are passed between Ops. If you decrease the work packet size, you decrease the required memory. For the shot detection example, you can play around with this number by adding work_packet_size=<size> (where <size> is an integer, with smaller values leading to less memory) to the db.run calls. (The documentation for db.run is here: http://scanner.run/api/scannerpy.html#scannerpy.database.Database.run)

  2. @willcrichton is the main person responsible for the reverse_image_search example. @willcrichton, can you advise here?

msharmavikram commented 6 years ago

@apoms Thanks for quick responses. For 2, I did the exactly the same thing after reading the document. (i must say your documents are comprehensive!). However, I am little stuck. Turns out the shot_detection example was created on old code database.

From the top of the tree, I cannot get shot_detection code working in CPU mode. (I am 80% close to working with hacks but I know these hacks are incorrect).

I realized that the function defs sample, space, slice, unslice are removed from op.py and some are moved to streams.py. I also noted a database.py does not support sampler anymore. However, shot_detection example still assumes these exits. I hacked these files to support these functions by looking into old commits and how you have done it before.

Now, I am stuck with : AttributeError: 'Sampler' object has no attribute '_col'

I was wondering if you have updated any example to latest code base from which I can actually play around? If not some tips that can help me get going is absolutely fine! :)

(I am actually thinking to write this example from scratch with the updated codebase.)

fpoms commented 6 years ago

I updated the code to the latest version, but need to verify that it works before pushing. I'll post here once it's committed.

msharmavikram commented 6 years ago

The update works for shot_detection example. I was able to run it in CPU mode without any hassle. For GPU, first run results with below error:

root@ecb5a4f071f9:/opt/scanner/examples/apps/shot_detection# python3 shot_detect.py  sample-clip.mp4 Detecting shots in movie sample-clip.mp4
Your Scanner configuration file (/root/.scanner/config.toml) does not exist. Create one? [Y/n] Y
Wrote Scanner configuration to /root/.scanner/config.toml
Server listening on 0.0.0.0:5001
Loading movie into Scanner database...
Time: 1.0s
Number of frames in movie: 4623
Computing a color histogram for each frame...
  5%|█▉                                  | 1/19 [00:01<00:18,  1.00s/it, workers=1, jobs=1, tasks=18]Error in atexit._run_exitfuncs:
Error in atexit._run_exitfuncs:
Error in atexit._run_exitfuncs:
Error in atexit._run_exitfuncs:
Error in atexit._run_exitfuncs:
Error in atexit._run_exitfuncs:
Error in atexit._run_exitfuncs:
Error in atexit._run_exitfuncs:
Segmentation fault (core dumped)
willcrichton commented 6 years ago

If you're still having this issue, can you run it in gdb and print the stack trace? It would also help if you make sure the build is in debug mode first.

cd /opt/scanner/build
cmake -D CMAKE_BUILD_TYPE=Debug ..
cd /opt/scanner
./build.sh
cd /app
willcrichton commented 6 years ago

@msharmavikram going to close this for now, but feel free to reopen if you're still having an issue.