Code Monkey home page Code Monkey logo

Comments (5)

ZikangZhou avatar ZikangZhou commented on June 15, 2024 8

Hi @moonseokha,

Sorry for the late reply.

def plot_single_vehicle(
    avm: ArgoverseMap, 
    sample_past_trajectory: np.ndarray,  # (20, 2)
    sample_groundtruth: np.ndarray,  # (20, 2) 
    sample_forecasted_trajectories: List[np.ndarray],  # List[(30, 2)]
    sample_city_name: str, 
    ls: str):

    sample_groundtruth = np.concatenate((np.expand_dims(sample_past_trajectory[-1], axis=0), sample_groundtruth), axis=0)
    for sample_forecasted_trajectory in sample_forecasted_trajectories:
        sample_forecasted_trajectory = np.concatenate((np.expand_dims(sample_past_trajectory[-1], axis=0), sample_forecasted_trajectory), axis=0)

    ## Plot history
    obs_len = sample_past_trajectory.shape[0]
    pred_len = sample_groundtruth.shape[0]
    plt.plot(
        sample_past_trajectory[:, 0],
        sample_past_trajectory[:, 1],
        color="#ECA154",
        label="Past Trajectory",
        alpha=1,
        linewidth=3,
        zorder=15,
        ls = ls
    )

    ## Plot future
    plt.plot(
        sample_groundtruth[:, 0],
        sample_groundtruth[:, 1],
        color="#d33e4c",
        label="Ground Truth",
        alpha=1,
        linewidth=3.0,
        zorder=20,
        ls = "--"
    )

    ## Plot prediction
    for j in range(len(sample_forecasted_trajectories)):
        plt.plot(
            sample_forecasted_trajectories[j][:, 0],
            sample_forecasted_trajectories[j][:, 1],
            color="#007672",
            label="Forecasted Trajectory",
            alpha=1,
            linewidth=3.2,
            zorder=15,
            ls = "--"
        )
        
        # Plot the end marker for forcasted trajectories
        plt.arrow(
            sample_forecasted_trajectories[j][-2, 0], 
            sample_forecasted_trajectories[j][-2, 1],
            sample_forecasted_trajectories[j][-1, 0] - sample_forecasted_trajectories[j][-2, 0],
            sample_forecasted_trajectories[j][-1, 1] - sample_forecasted_trajectories[j][-2, 1],
            color="#007672",
            label="Forecasted Trajectory",
            alpha=1,
            linewidth=3.2,
            zorder=15,
            head_width=1.1,
        )
    
    ## Plot the end marker for history
    plt.arrow(
            sample_past_trajectory[-2, 0], 
            sample_past_trajectory[-2, 1],
            sample_past_trajectory[-1, 0] - sample_past_trajectory[-2, 0],
            sample_past_trajectory[-1, 1] - sample_past_trajectory[-2, 1],
            color="#ECA154",
            label="Past Trajectory",
            alpha=1,
            linewidth=3,
            zorder=25,
            head_width=1.0,
        )

    ## Plot the end marker for future
    plt.arrow(
            sample_groundtruth[-2, 0], 
            sample_groundtruth[-2, 1],
            sample_groundtruth[-1, 0] - sample_groundtruth[-2, 0],
            sample_groundtruth[-1, 1] - sample_groundtruth[-2, 1],
            color="#d33e4c",
            label="Ground Truth",
            alpha=1,
            linewidth=3.0,
            zorder=25,
            head_width=1.0,
        )

    ## Plot history context
    for j in range(obs_len):
        lane_ids = avm.get_lane_ids_in_xy_bbox(
            sample_past_trajectory[j, 0],
            sample_past_trajectory[j, 1],
            sample_city_name,
            query_search_range_manhattan=65,
        )
        [avm.draw_lane(lane_id, sample_city_name) for lane_id in lane_ids]

    ## Plot future context
    for j in range(pred_len):
        lane_ids = avm.get_lane_ids_in_xy_bbox(
            sample_groundtruth[j, 0],
            sample_groundtruth[j, 1],
            sample_city_name,
            query_search_range_manhattan=65,
        )
        [avm.draw_lane(lane_id, sample_city_name) for lane_id in lane_ids]

from hivt.

xinfu607 avatar xinfu607 commented on June 15, 2024 3

Thank you for reply and good code. :)
Hi,
Could you please release the complete visualization code? Thanks a lot.

from hivt.

moonseokha avatar moonseokha commented on June 15, 2024

Thank you for reply and good code. :)

from hivt.

Joonki0111 avatar Joonki0111 commented on June 15, 2024

Hi, i've seen the code and i want to know how to get those samples in the code below

def plot_single_vehicle(
avm: ArgoverseMap,
sample_past_trajectory: np.ndarray, # (20, 2)
sample_groundtruth: np.ndarray, # (20, 2)
sample_forecasted_trajectories: List[np.ndarray], # List[(30, 2)]
sample_city_name: str,
ls: str):

there is no code generating sample_past_trajectory, sample_groundtruth, sample_forecasted_trajectories
in HiVT repository so i cant run that code.

any help and suggestions will be helping my project alot.
Thanks :)

from hivt.

MPCheng-ZW avatar MPCheng-ZW commented on June 15, 2024

Hi, have you solved this problem? Thank you!
@Joonki0111 @xinfu607 @moonseokha @ZikangZhou

Hi, i've seen the code and i want to know how to get those samples in the code below

def plot_single_vehicle( avm: ArgoverseMap, sample_past_trajectory: np.ndarray, # (20, 2) sample_groundtruth: np.ndarray, # (20, 2) sample_forecasted_trajectories: List[np.ndarray], # List[(30, 2)] sample_city_name: str, ls: str):

there is no code generating sample_past_trajectory, sample_groundtruth, sample_forecasted_trajectories in HiVT repository so i cant run that code.

any help and suggestions will be helping my project alot. Thanks :)

from hivt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.