-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/Sproc01/8BallPool
- Loading branch information
Showing
20 changed files
with
601 additions
and
589 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
\subsection{Balls detection} | ||
To detect balls, Michele proposed a multi-step preprocessing approach. Initially, the table region is isolated using an approach similar to the segmentation described before. Then the corners area is removed to prevent Hough Circle transform to find them as false positives. Subsequently k-means clustering was applied to the image with k=5 (the number of balls type plus the playing field). The resulting clusterized \texttt{Mat} is converted to gray-scale to be used as \texttt{HoughCircle} input. The gray-scale output colors were selected to be as different from each other once the color space is changed. | ||
|
||
Circle parameters, such as radius and center color, were analyzed to identify potential ball regions. By calculating the mean radius of in-table circles with center not selected by the color mask, a radius range was established. Circles within this radius range were considered for further analysis. | ||
|
||
Ball classification involved creating a circular mask, computing the gray-scale histogram, and excluding background pixels from the values of the histogram. Peak values in the histogram were used to differentiate between striped and solid balls, while HSV color space analysis is used to distinguish white and black balls. | ||
|
||
To detect balls, Michele proposed a multi-step preprocessing approach. Initially, the table region was isolated by constructing a polygon using its corners and a color-based mask is generated. Subsequently, pixels outside the table were nullified, and k-means clustering was applied to the image. The resulting clusters were converted to gray-scale for Hough Circle Transform application. | ||
Circle parameters, such as radius and center color, were analyzed to identify potential ball regions. By calculating the mean radius of in-table circles with center not selected by the color mask, a radius range was established. Circles within this radius range were considered for further analysis. Ball classification involved creating a circular mask, computing the gray-scale histogram, and excluding background pixels from the values of the histogram. Peak values in the histogram were used to differentiate between striped and solid balls, while HSV color space analysis is used to distinguish white and black balls. | ||
After finding the balls, the team identified an optimization opportunity. Since there's only one white ball and one black ball, Michele implemented non-maxima suppression for white and black balls independently, in order to improve performance. | ||
The result of the detection process is then used to segment the balls. | ||
|
||
The result of the detection process is then used to segment the balls. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
\section{Conclusions} | ||
Our program demonstrates consistent performance across the dataset. Notably, table detection achieves high accuracy. However, ball classification presents some challenges due to their varying sizes and colors that can sometimes are similar to the one of the table. | ||
Our approach demonstrates consistent performance across the dataset. Notably, table detection achieves high accuracy. However, ball classification presents some challenges due to their varying sizes and colors that can sometimes are similar to the one of the playing field, also solid and striped balls are difficult to distinguish because % TODO riflessi e poca parte bianca visibile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
\section{Executables} | ||
The program contains 4 different executables: | ||
\begin{itemize} | ||
\item \texttt{8BallPool}: the main executable that given a video file, it processes it and creates the output video. | ||
\item \texttt{TestAllClip}: the executable that was used to test the detection and segmentation in all the first and last clip of all videos. | ||
\item \texttt{ShowSegmentationColored}: the executable that was used to show the ground truth of the segmentation of a particular frame and it was also used | ||
as test for the code that computes the metrics because it computes the performance of the ground truth it self. | ||
\item \texttt{ComputePerfomance}: This executable was used to compute the performance across the dataset so the mAP and the mIoU. | ||
\item \texttt{8BallPool}: the main executable that, given a video file, it processes it and creates the output video with the superimposed minimap. | ||
\item \texttt{TestAllClip}: it is the executable used to test the detection and segmentation in the first and last frame of all videos through AP and IoU by comparing them with the ground truth. | ||
\item \texttt{ShowSegmentationColored}: is an helper which has been used to show the ground truth of the segmentation of a particular frame using human-readable colors and it was also used as a test for the code that computes the metrics because it computes the performance of the ground truth on itself. | ||
\item \texttt{ComputePerformance}: is used to compute the performance across the dataset so the mAP and the mIoU. | ||
\end{itemize} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
\section{Metrics} | ||
The \textit{computePerformance} executable handles both mAP and mIoU calculations. | ||
\begin{itemize} | ||
\item mAP (mean Average Precision): | ||
\begin{itemize} | ||
\item Predictions are made for all first and last frames in a video. | ||
\item Since we lack alternative confidence scores, we opted to calculate mAP using IoU as the measure of confidence, because it is a good indicator of how good the detection is. | ||
\item For each object class (e.g., ball type), the Average Precision (AP) is calculated. | ||
\item Then the final mAP is obtained by averaging the AP values across all classes. | ||
\end{itemize} | ||
\end{itemize} | ||
\begin{itemize} | ||
\item mIoU (mean Intersection over Union): | ||
\begin{itemize} | ||
\item IoU is calculated for the first and the last frame for each video. | ||
\item The average IoU is then computed for each object class across all 20 images (10 videos each one with 2 frame). | ||
\item Finally, the mIoU is obtained by averaging the IoU values obtained in the last step. | ||
\end{itemize} | ||
\end{itemize} | ||
The 8BallPool executable displays the performance metrics (AP and IoU) achieved by the method for the specific input video. | ||
The \texttt{computePerformance} executable handles both mAP and mIoU calculations. | ||
|
||
% TODO check if explanations are correct | ||
\noindent\textbf{\emph{mAP (mean Average Precision)}}: | ||
\begin{enumerate} | ||
\item Predictions are performed for all first and last frames in a video. | ||
\item Since we lack alternative \textit{confidence scores}, we opted to calculate mAP using IoU as the measure of confidence, because it is a good indicator of how good the detection is. | ||
\item For each object class (e.g., ball type), the Average Precision (AP) is calculated. | ||
\item Then the final mAP is obtained by averaging the AP values across all classes. | ||
\end{enumerate} | ||
|
||
\noindent\textbf{\emph{mIoU (mean Intersection over Union)}}: | ||
\begin{enumerate} | ||
\item IoU is calculated for the first and the last frame for each video. | ||
\item The average IoU is then computed for each object class across all 20 images (10 videos each one with 2 frame) in the dataset. | ||
\item Finally, the mIoU is obtained by averaging the IoU values obtained in the last step. | ||
\end{enumerate} | ||
|
||
The 8BallPool executable displays the performance metrics (AP and IoU) achieved by the method for the specific input video. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.