PBBML L9
PBBML L9
https://www.synopsys.com/automotive/what-is-autonomous-car.html
Self-Driving Cars Trend
BBC https://youtu.be/aoBthMBVsZc?si=yQkQfUKVxTC8fKZ8
https://english.elpais.com/technology/2024-06-18/study-finds-self-driving-cars-are-safer-than-human-driven-vehicles.html
Self-Driving Car Trends
• Another trend is the integration of self-driving cars with other technologies,
such as smart cities and connected infrastructure. This integration can
optimize traffic flow, reduce congestion, and improve overall transportation
efficiency.
• Companies are working to create intuitive and comfortable self-driving
experiences, with features like personalized entertainment systems and
seamless integration with other devices.
https://www.idtechex.com/en/research-report/software-defined-vehicles-connected-cars-and-ai-in-cars-2024-2034-markets-trends-and-forecasts/974
Self-Driving Cars
1. Sensing the Environment:
• LiDAR (Light Detection and Ranging): sensors emit laser beams
that bounce off objects in the environment and return to the car.
By measuring the time it takes for the laser pulses to return, the car
can create a detailed 3D map of its surroundings (The distance,
shape, and movement of objects like other cars, pedestrians, and
obstacles)
https://youtu.be/Zl3YSPilT-w?si=JrVrSDZuw5_xlRQb
https://www.eejournal.com/article/self-driving-cars-what-the-engineers-think/
Self-Driving Cars
1. Sensing the Environment:
• Cameras: Multiple cameras are used to capture visual information
about the road, traffic signs, lane markings, and other vehicles.
These cameras help the car identify objects, recognize traffic signals,
and understand the overall driving context.
• Radar: Radar sensors emit radio waves that bounce off objects and
return to the car. Radar can detect objects even in low visibility
conditions, such as fog or darkness.
https://youtu.be/Zl3YSPilT-w?si=JrVrSDZuw5_xlRQb
https://www.eejournal.com/article/self-driving-cars-what-the-engineers-think/
Self-Driving Cars
2. Data Processing and Decision Making:
• AI Algorithms: The collected data from the sensors is processed by
powerful AI algorithms. These algorithms analyze the data to understand
the environment, identify potential hazards, and make real-time
decisions about how to navigate the road safely.
https://neptune.ai/blog/self-driving-cars-with-convolutional-neural-networks-cnn
Self-Driving Cars
2. Data Processing and Decision Making:
• Mapping and Localization: The car uses high-definition maps and GPS
to determine its precise location and orientation on the road. This
information is crucial for planning routes, identifying intersections, and
understanding traffic patterns.
• Object Detection and Tracking: AI algorithms are used to detect and
track objects in the environment, such as other cars, pedestrians, and
cyclists. This helps the car anticipate their movements and take
appropriate actions to avoid collisions.
https://www.youtube.com/watch?v=Zl3YSPilT-w
Self-Driving Cars
3. Vehicle Control:
• Actuators: Once the AI algorithms have made a decision, they send
commands to the vehicle's actuators, such as the steering wheel,
brakes, and accelerator. These actuators control the car's movement,
ensuring it follows the planned path and responds to changing
conditions.
https://neptune.ai/blog/self-driving-cars-with-convolutional-neural-networks-cnn
https://www.youtube.com/watch?v=Zl3YSPilT-w
Self-Deriving Car Ethical Issues
• https://youtu.be/ixIoDYVfKA0
https://www.technologyreview.com/2018/10/24/139313/a-global-ethics-study-aims-to-help-ai-solve-the-self-driving-trolley-problem/
5 Moral dilemmas that self-deriving cars face today
i=1, 2, 3, 4, 5, 6, 7
else:
If :
False
i%3==0? print( i )
True
If : False
i%2==0?
True
pass
for
loop
i=1, 2, 3, 4, 5, 6, 7
else:
If : False
i%3==0? print( i )
True
False
If :
i%2==0?
True
continue
print( i )
for
loop
i=1, 2, 3, 4, 5, 6, 7
If you print 3, don’t use if & else structure
If : False
i%3==0?
True
False
If :
i%2==0?
True
continue
print( i )
print( i )
Make the flow chart of this algorithm
By Yourself
Pass vs Continue
for Loop
for Loop
commandment
commandment
Condition 1
commandment1
If True
commandment 1
condition1
Condition 2
commandment2
False
commandment3
If True
commandment 2
condition2
False
commandment 3
Print(“\n”)
Pass vs Continue
for Loop
for Loop
commandment
commandment
Condition 1
commandment1
If True
commandment 1
condition1
Condition 2
Continue
False
commandment2
commandment3
If True
commandment 2
condition2
False
commandment 3
Print(“\n”)
Pass vs Continue
for Loop
for Loop
commandment
commandment
Condition 1
commandment1
If True
commandment 1
condition1
Condition 2
Continue
False
commandment2
commandment3
If True
commandment 2
condition2
False
commandment 3
Print(“\n”)
Practice with new code example!
Fill the blank parts of the algorithm
Pandas
• Pandas is an open-source Python library that is widely used for
data manipulation and analysis, especially in data science and
machine learning.
• It provides data structures and functions designed to work with
structured data, like data tables or time series, making it easier to
clean, transform, and analyze data efficiently.
Pandas
Core Data Structures
• Series: A one-dimensional labeled array that can
hold any data type (integers, strings, floats, etc.).
It is essentially a single column of data, with an
index for each value.
• DataFrame: A two-dimensional labeled data
structure, similar to a table in a database or an Excel
spreadsheet. It has rows and columns, making it
ideal for handling datasets.
Pandas
Data Loading
• Pandas has built-in functions to read data from various formats,
such as CSV, Excel, SQL databases, JSON, and more.
• For example, pd.read_csv("file.csv") loads a CSV file into a
DataFrame, making it straightforward to work with external
datasets.
df.dtypes
• It returns the data types of each column in a
DataFrame. It helps you understand the type
of data stored in each column, which is
crucial for data cleaning and analysis.
• Common data types you might see include:
• int64 for integer values,
• float64 for decimal numbers,
• object for strings or mixed data,
• datetime64 for date and time data,
• bool for Boolean values.
df.info()
• It provides a concise summary of a DataFrame.
It gives important details about the structure and
contents of the DataFrame
• Index and Columns: DataFrame’s index type, the
number of entries, and the names of each column.
• Non-Null Counts: For each column, it shows how
many non-null (non-missing) values are present,
which helps in assessing if there’s any missing data.
• Data Types: The data type of each column (e.g., int64,
float64, object, etc.) is displayed, allowing you to
understand what kind of data each column holds.
• Memory Usage: It shows the memory usage of the
DataFrame, which is helpful when working with large
datasets.
df.describe()
• It a summary of statistical measures for numerical
columns in a DataFrame. It is helpful for quickly
gaining insights into the distribution and central
tendencies of your data.
• When df.describe is used with numerical columns,
it typically returns
• Count: The number of non-null values in each column.
• Mean: The average value of each column.
• Standard Deviation (std): Measures how spread out the values are from
the mean.
• Minimum (min): The smallest value in each column.
• 25% (1st Quartile): The value below which 25% of the data falls.
• 50% (Median or 2nd Quartile): The middle value, dividing the data in half.
• 75% (3rd Quartile): The value below which 75% of the data falls.
• Maximum (max): The largest value in each column.
df.[‘column name’].mode()
• It is used to find the most frequent value(s) in a
specific column of a DataFrame.
• Here's a breakdown of what each part does:
• df: Refers to the DataFrame you’re working with.
• ['column name']: Specifies the particular column within the
DataFrame you want to analyze (replace column name with
the actual name of your column).
• .mode(): A method that calculates the mode, or most
frequently occurring value(s) in the column.
df.loc[df['population']>=1000]
• It is used to filter rows in a DataFrame based on a condition.
• Here's a breakdown of what each part does:
• df: Refers to the DataFrame you’re working with.
• ['population']: Specifies the column in the DataFrame, in this case, population.
• df['population'] >= 1000: This creates a boolean mask (a series of True or False values)
where each row is True if the value in the population column is greater than or equal to 1000
and False otherwise.
• df.loc[ ... ]: The loc method is used to select rows (or columns) by label or condition.
Here, it selects all rows where the condition inside (i.e., df['population'] >= 1000) is True.
Pandas
Data Manipulation and Cleaning
• Filtering and Selecting Data: You can filter data based on
conditions, select specific columns, or retrieve rows that meet
particular criteria.
• Handling Missing Data: Functions like dropna() and fillna() allow
you to handle missing data by removing or replacing it with default
values.
• Sorting and Ranking: Pandas provides functions like sort_values()
to sort data by specific columns.
• Transforming Data: Using methods like apply(), you can apply
custom functions to modify data within your DataFrame.
Pandas
Data Aggregation and Grouping
• You can use the groupby() function to group data by one or more
columns and apply aggregation functions like sum(), mean(),
count(), etc., which is helpful for summarizing data by categories.