Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running Steps #8

Open
Akhtar303 opened this issue Feb 21, 2019 · 13 comments
Open

Running Steps #8

Akhtar303 opened this issue Feb 21, 2019 · 13 comments

Comments

@Akhtar303
Copy link

Akhtar303 commented Feb 21, 2019

Hi @dimroc ,@thoughtmerchant and @whatrocks ,
I want to use your code but I don't need to use your Interface of your project.
but I want to use your ML part with simple demo i.e give video frame or only image to count number of people in line.i
so kindly guide me some step of your project to complete my job.
Thanks

@dimroc
Copy link
Owner

dimroc commented Feb 22, 2019

Hey there @Akhtar303, you can run the count model against a single frame with the python manage.py predict command. Documentation and help is lacking, so check out the source: https://github.com/dimroc/count/blob/master/ml/crowdcount/management/commands/predict.py#L12-L16

cd ml
python manage.py # lists all available ML commands

# python manage.py predict --image <path to image> --just-predictions
python manage.py predict --image data/shakecam/shakeshack-1500925619.jpg --just-predictions 

There are two big considerations however:

  1. You'll need to install the dependencies, which isn't always straightforward:
    • cd ml
    • conda-env create -f environment.yml or conda env update -f=environment.yml
    • The environment may have experienced decay or erosion, in that dependencies may have changed or been deprecated.
  2. The prediction model is tailored to the shakecam and won't give a good prediction for a random video frame with different camera position and person layout.

I doubt this will be as straightforward as my todo list implies above :/. Good luck.

@Akhtar303
Copy link
Author

python manage.py --image data/shakecam/shakeshack-1500925619.jpg --just-predictions 
``

Thanks @dimroc
when I have run file it doesn't recognize the image flag Unknown command: --image
python manage.py --image data/shakecam/shakeshack-1500925619.jpg --just-predictions
so kindly help me

@philkim72
Copy link

Hi @dimroc - I was hoping to be able to access your set of annotated shackcam images. Is it possible to share?

@dimroc
Copy link
Owner

dimroc commented Apr 21, 2019

@Akhtar303 I missed a word

python manage.py predict --image data/shakecam/shakeshack-1500925619.jpg --just-predictions 

Please use python manage.py help to see all commands. This is a standard django command.

@dimroc
Copy link
Owner

dimroc commented Apr 21, 2019

@philkim72 The annotations are in json and can be found in the repo here: https://github.com/dimroc/count/tree/master/ml/data/annotations

If you're looking to generate an image like the one below, you'll need to run one of the commands above (I think python manage.py preview_label or python manage.py predict)
image

@philkim72
Copy link

@dimroc I have successfully annotated the images following your instructions. One quick question. There is a file called ignorables.csv. It seems you are ignoring some pictures because there are some counting issues such as umbrellas. But there are other images you ignore that seem perfectly fine. Can you explain what your criteria was for ignoring certain images in your training data set?

@dimroc
Copy link
Owner

dimroc commented Apr 25, 2019

I think I just thought the annotations were wrong. If there’s more to it, please feel free to remind me, it’s been a while.

@philkim72
Copy link

Thanks. I can't find any common pattern at this point, but I will just ignore the entire list for now. By the way, I noticed that recently they put a tent at the front of the line. I'm assuming part of it has to do with it's rainy season right now, but i'm afraid that it might be a permanent thing. Do you have any thoughts about how to get around this issue?

@dimroc
Copy link
Owner

dimroc commented Apr 25, 2019

At this time no. Many crowd counting models and algorithms rely on creating a density map of heads, as shown below. If we can't see the head, we're in trouble. But feel free to do some further reading here to see if someone else has a solution: https://github.com/gjy3035/Awesome-Crowd-Counting

image

@Akhtar303
Copy link
Author

python manage.py predict --image data/shakecam/shakeshack-1500925619.jpg --just-predictions

Thanks @dimroc for reply
when I run python3 manage.py predict --image data/shakecam/shakeshack-1500925619.jpg --just-predictions it genrate error because it is unable to read json file from mall.json and I have given absolute path ='/home/akhtar/crowd_counting/count/ml/data/annotations/mall.json'

Error:"/usr/lib/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

This error genrate by this line dic.update(json.load(infile)) in regresion.py

after that I want to read simple mall.json it genrate same error
import json
with open('/home/akhtar/crowd_counting/count/ml/data/annotations/mall.json') as json_file:
data = json.load(json_file)

Error:ile "/usr/lib/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Thanks

@ramondebruyn
Copy link

Hi @dimroc,

Thanks so much for this incredible code and example!

I've been playing around with the models and code for the past weeks or so, and am having some trouble. 2 quick questions:

  1. When I open the iOS or MacOS example apps, I get various errors after trying to install the dependancies - most of the errors are related to dependancies. Do you by any chance have a more recent implementation example in iOS?
  2. In playing around with the HundredsPredictor.mlmodel in a separate app (copying the actual mlmodel in the fresh app), I'm able to get an output form the model, but it's in the form of a MultiArray (Double 1 x 168 x 225). The only output fields I have access to are: "requestRevision", "confidence" and "timeRange", but the rest is inaccessible. How do I go about extracting the actual estimated count from the image that I passed into the HundredsPredictor?

[<VNCoreMLFeatureValueObservation: 0x2801a75a0> A94E606F-856D-4D56-846D-B5E8A513EAAE requestRevision=1 confidence=1.000000 timeRange={{0/1 = 0.000}, {0/1 = 0.000}} "density_map" - "MultiArray : Double 1 × 168 × 225 array" (1.000000)]

Thanks again for the amazing work!

Best,
Ramon

(PS. I'm using Xcode 12.4 & iOS 14.4 to run the above packages.)

@dimroc
Copy link
Owner

dimroc commented Feb 27, 2021 via email

@ramondebruyn
Copy link

Thanks for the response, @dimroc. I'll keep digging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants