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 inference #8

Closed
Tanay0101 opened this issue Jun 24, 2021 · 3 comments
Closed

Running inference #8

Tanay0101 opened this issue Jun 24, 2021 · 3 comments

Comments

@Tanay0101
Copy link

Tanay0101 commented Jun 24, 2021

Hi, great work !! I am trying to run inference on some of my own images, but the output is incorrect. Here are the steps I followed:-

  1. Loaded the small model trained on curvelanes dataset
  2. Resized the image to (800,320) [I want the output size to be (800,320) only].
  3. Got the predictions
  4. Supplied the predictions to the appropriate post-processor with downscale = 8.
  5. Supplied the output of the post-processor to adjust_results function with the following parameters
    :- crop_shape = (320,800)
    img_shape = (320,800)
    crop_offset = (0,0)
    ori_shape = (320,800)
  6. The output I am getting is this -
    https://drive.google.com/file/d/1BwTaZ1I5VVWAEoQKjx2q6-Wg8UFzv6fT/view?usp=sharing

It would be great if you can tell me where I am going wrong.

Thank You

@Tanay0101
Copy link
Author

Tanay0101 commented Jun 29, 2021

The only way I was able to run it was by emulating the directory structure of one of the datasets. So if you want to run inference on a video, try to save it exactly like culane dataset.

  1. Create a parent folder in the project directory named video_frames, containing 2 more folders of data and list.
  2. Extract all the frames from the video and save them in the data folder with one empty txt file for each image. So if your image is named 0032.jpg, the corresponding empty txt file will be 0032.lines.txt. Do this for every image.
  3. Save the relative path from the video_frames folder for every image in a txt file named test.txt. So for the above image, the txt file will have the following line: "/data/0032.jpg"
    4.Do this for every image that you want to run inference on. Create two empty txt files, train.txt and val.txt.

Now edit the data root to point towards the video_frames folder. Run the model as given in the repo. Remember that these steps are for test_culane.py file. To test out tusimple simply swap out the model from culane_small.pth to tusimple_small.pth. I have tested it and it works.

@MeloHo
Copy link

MeloHo commented Sep 27, 2021

Although this is closed, I did want to add more comments on how to run inference, which could be a reference for other people.
I tried out the tusimple model on my own data.

  1. Create a folder to contain your own image data.
  2. Put you images under that folder. Make sure your image size is (1280, 720)
  3. Also create a json file (test_label.json). In that json file:
    for img in imgs: obj = {"lanes": [], "h_samples": [], "raw_file": "path_to_img"} json.dump(obj, file_handle)
  4. Follow the official instruction to modify the data path under config/.../
  5. Add --show when running the inference to see the plotted images. Further modify the code to see the output values for each lane.

@MuftawoOmar
Copy link

Although this is closed, I did want to add more comments on how to run inference, which could be a reference for other people. I tried out the tusimple model on my own data.

  1. Create a folder to contain your own image data.
  2. Put you images under that folder. Make sure your image size is (1280, 720)
  3. Also create a json file (test_label.json). In that json file:
    for img in imgs: obj = {"lanes": [], "h_samples": [], "raw_file": "path_to_img"} json.dump(obj, file_handle)
  4. Follow the official instruction to modify the data path under config/.../
  5. Add --show when running the inference to see the plotted images. Further modify the code to see the output values for each lane.

hello @MeloHo , could you please clarify on point number 3, where should

for img in imgs: obj = {"lanes": [], "h_samples": [], "raw_file": "path_to_img"} json.dump(obj, file_handle) be placed should be a new python script or should be added some where in the original code base

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