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

How to start the scripts #3

Open
Cuky88 opened this issue Jan 31, 2018 · 18 comments
Open

How to start the scripts #3

Cuky88 opened this issue Jan 31, 2018 · 18 comments

Comments

@Cuky88
Copy link

Cuky88 commented Jan 31, 2018

Hi,

I have problems using your post processing scripts.

  1. I start generate_bboxes.py with: python generate_bboxes.py --session 1 --dataroot Data --pixel_path Data
    The zip file is extracted in "Data/'runguid'" and the npz files are under "Data"
  2. Then I start genvoc.py with: python genvoc.py --out TestOut --image_path Data/bca0a265-0e7f-415b-a41f-2052b7517d0e --pixel_path Data --query "SELECT * FROM detections JOIN snapshots USING (snapshot_id) JOIN runs USING (run_id) JOIN sessions USING (session_id) WHERE snapshot_id=1"
    I have a test folder "TestOut" where the files should be saved. But only empty folders are created and a png in "SegmentationObject", which is just black.
  3. In this line you used some color code, which are not in the script. So I tried a list: colors = [(255,0,255), (55,0,55), (34,33,87)] Is this correct?
  4. When printing out the status in generate_bboxes.py, there are always 0 detections, even if the cars are "correctly" annotated like in the images in the zip file. The fields best_bbox and coverage in table detections won't be updated also.

Can you help please?

Cheers,

@IanKirwan
Copy link

IanKirwan commented Mar 3, 2018

Hi @Cuky88,

Did you get to the bottom of this?
I tried running genvoc (I havent run generate_bboxes yet):
python genvoc.py --query "select * from detections;" --out D:\Snapshots\Output\genvoc --image_path D:\Snapshots\Output
But the script fails because there is no runguid in the detections. Perhaps I need to run generate_bboxes first.

@Cuky88
Copy link
Author

Cuky88 commented Mar 3, 2018

I didn't. I don't use SQL or the post processing. I write out everything in json and do my own post processing.

@IanKirwan
Copy link

OK, thanks for the fast update 👍 .
Are you doing that in your GTAV scripts project?

@Cuky88
Copy link
Author

Cuky88 commented Mar 3, 2018

GTAV Scripts is just a collection of some useful scripts. I use GTAVisionExport for extracting the buffers and writing out all the data. Everything else is done in python when post processing.

@IanKirwan
Copy link

Looking at the code in genvoc.py I think you should have set image_path to the folder containing the folders with guid names each containing a set of images.

@IanKirwan
Copy link

HI @Cuky88,
Could you tell me where do these npz files come from? I dont appear to have any. I have the postgres detections and the zip files but no npz files.

@Cuky88
Copy link
Author

Cuky88 commented Mar 5, 2018

Hi @IanKirwan
Unfortunately I can't remember exactly. I extracted the zip files in folders, e.g. Data/bca0a265-0e7f-415b-a41f-2052b7517d0e and ran the command:

python generate_bboxes.py --session 1 --dataroot Data --pixel_path Data

This script was creating the npz data.

@IanKirwan
Copy link

IanKirwan commented Mar 6, 2018

Thanks @Cuky88. I managed to get generate_boxes to process a small zip worth of images and generate the npz files, but anything more than that it fails. Had to limit the process pool size to less than 65 to get it to work. genvoc.py still not working though.

@Cuky88
Copy link
Author

Cuky88 commented Mar 6, 2018

Which SQL statement did you use for genvoc.py? As far as I can remember, you can't use just "SELECT * FROM detections". Try to run genvoc with:

python genvoc.py --out SOME/FOLDER/FOR/SAVING/RESULTS --image_path Data/bca0a265-0e7f-415b-a41f-2052b7517d0e --pixel_path Data --query "SELECT * FROM detections JOIN snapshots USING (snapshot_id) JOIN runs USING (run_id) JOIN sessions USING (session_id) WHERE snapshot_id=1"

Just make sure that --image_path and --pixel_path are the same as in generate_bboxes.py.

@Cuky88 Cuky88 closed this as completed Mar 6, 2018
@Cuky88 Cuky88 reopened this Mar 6, 2018
@IanKirwan
Copy link

I basically used your invocation from the OP:
SELECT * FROM detections JOIN snapshots USING (snapshot_id) JOIN runs USING (run_id) JOIN sessions USING (session_id);
I omitted the snapshot id, thinking that it should just process all of the snapshots. Should I just be doing one sample per call to genvoc?

@IanKirwan
Copy link

OK, I ran it with the snapshot_id back in, and set to the id of one of the images in the specified image_path. The code executes to completion, creates a set of folders in the 'out' folder with nothing but 'trainval.txt' in imagesets\main.

@IanKirwan
Copy link

IanKirwan commented Mar 7, 2018

Well I've managed to get genvoc to generate the annotation xml files. It generates a file called trainval.txt with a list of output sample numbers. However JPEGImages folder contains empty images, and the SegmentationObject folder is empty. Getting closer I think.

I generated the npz files to a separate folder to the dataroot, and dataroot contains the unzipped folders labelled by runguid:
python generate_bboxes.py --session 1 --dataroot d:\datasets\GTAVisionExport --pixel_path d:\datasets\npz
Then I run genvoc:
python genvoc.py --out D:\datasets\genvoc --pixel_path D:\datasets\npz --image_path D:\Datasets\GTAVisionExport --query "SELECT * FROM detections JOIN snapshots USING (snapshot_id) JOIN runs USING (run_id) JOIN sessions USING (session_id);"
I had to modify genvoc as functions like open() doesnt like WindowsPath, so changed them to e.g. open(str(windows_path)).

@IanKirwan
Copy link

genvoc.py only appears to colour segment vehicles at the moment. I therefore set colours to Yellow:
colors = [(255,255,0)] #only does cars atm

@IanKirwan
Copy link

IanKirwan commented Mar 11, 2018

@Cuky88 Any idea why the code is only generating segmentations for a subset of the vehicles in an image? This seems contrary to what is said in the paper.

@IanKirwan
Copy link

P.S. The colours are supposed to follow the Pascal VOC format. You can run the VOClabelcolormap.m script to generate a set of colours to use. The code is here: Pascal VOC devkit.

@Cuky88
Copy link
Author

Cuky88 commented Mar 13, 2018

Hi Ian,
I don't know why the script behaves strange, maybe it's intentionally. Like I said before, I use my own postprocessing, which is fine for me. I can't put much time into it right now, sorry for that.

@IanKirwan
Copy link

No worries. Thanks for the help on this anyway. Just frustrating as it feels very close to being right. Going to look at the contour generation and stencil culling, as I think this is where the problem lies.

@nicksauca
Copy link

Hi @IanKirwan,
In case you are still searching why genvoc.py generates only a subset of the vehicles: The author of the code didn't thought about randomness in the answer of the database, so the script only saves the objects of the last occurencies of snapshot_id from the database answer. To solve it, add an order by snaphot_id desc; at the end of the query. You should obtain something like: SELECT * FROM detections JOIN snapshots USING (snapshot_id) JOIN runs USING (run_id) JOIN sessions USING (session_id) ORDER BY snapshot_id desc;

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

3 participants