Return to site

Parking Slot Detection Github

broken image


Info

  1. Parking Slot Detection Github Tool
  2. Parking Slot Detection Github Software
  3. Parking Slot Detection Github Failed
  4. Parking Slot Detection Github Download
  5. Parking Slot Detection Github Software

The parking-slot detection module takes the surround-view image as the input, detects the parking-slots, and finally sends their physical positions with respect to the vehicle-centered coordinate system to the decision module for further process. Representative work on vision-based parking-slot detection will be reviewed as follows. Free parking slot output and 11,328 samples of occupied parking slot output. After comparing with the expected outcome then proceedings are being applicable towards the proposed approach, it can be witnessed in Table 1 that the result of our proposed approach during training is 94.37% accurate, and the miss rate is 5.66%.

This Parking Lot Problem is a popular programming assignment at various companies, like Google and Amazon. We are to utilize the appropriate data structures to solve a straightforward yet intricate problem of assigning vehicle slots, in Golang. The problem statement and its solution are first described. Finally, a code refactoring exercise, which is an extension to the original problem, is posed at the bottom of this page.

Problem Statement

Mr Zorro owns a multi-storey parking lot that can hold up to n vehicles at any given point in time. The parking slots are numbered, beginning at 1 and increases with increasing distance from the entry point in steps of one. Mr Zorro has requested your help to design an automated ticketing system for his parking lot.

Github

When a vehicle enters the parking lot, its vehicle registration number (i.e., number plate) and colour are noted. Then, an available parking slot is allocated. Following are the rules of parking slot ticket issuance:

  • Each customer should be allocated the nearest available parking slot to the entry point.
  • Upon exiting the parking lot, the customer returns the ticket which marks their previously allocated lot as now available.
  • The system should provide the ability to determine:
    • Registration numbers of all cars of a particular colour.
    • Slot number in which a car with a given registration number is parked.
    • Slot numbers of all slots where a car of a particular colour is parked.

The ticketing system should be operable via two modes of input, namely, interactive commands and commands from a file. In other words, the ticketing system should be an executable which accepts:

  1. Interactive commands from an interactive command prompt shell
  2. A filename as an input argument at the command prompt and executes the commands from the given file

Example below includes all the commands which need to be supported.

Example: File Input

To run the code so it accepts input from a file:

People are seen Friday, Sept. 25, 2015, near the Haggen store at 1940 Village Center Circle in western Las Vegas. The company plans to leave the Nevada market as well as the Pacific Southwest. 2 visitors have checked in at Kegelcasino Hagen. Kegel casino hagen golf. Kegel- und Bowlingzentrum Hagen. Das Kegelzentrum Hagen - seit unter neuer Leitung. Frisch renoviert und attraktiver als jemals zuvor - Kegel- und Bolingzentrum Hagen. Kegel takes a shower while Darren and Molly are at the movies. Movie 56,784 Views (Ages 13+) kegel: in my day by jato. Kegel and Argus hang out on a bench at the park. Movie 20,028 Views (Ages 13+) kegel: campfire chat by jato. Kegel and friends sit around a campfire and chat. Movie 43,233 Views. Recognized as the leading experts in lane maintenance, KEGEL is the official partner for all major governing bodies of bowling - ABF, ETBF, PABCON, USBC, and WTBA.

Input (contents of file):

Spirit mountain casino needles. TRIBAL OFFICES Location 500 Merriman Avenue Needles, CA 92363 p (760) 629-4591 f (760) 629-6144. Spirit Mountain Casino Requires Face Masks For Guests & Employees. As of 11/17/20 smoking is not allowed indoors or within 20 feet of any entrance. With the current rise in COVID-19 cases, Spirit Mountain Casino is implementing the temporary safety measure of making the entire casino facility non-smoking. This includes 20 feet from all. Spirit Mountain Casino and Mesquite Grill, Mohave Valley: Address, Phone Number, Spirit Mountain Casino and Mesquite Grill Reviews: 3.5/5. United States; Arizona (AZ) Mohave Valley; Things to Do in Mohave Valley; Spirit Mountain Casino and Mesquite Grill. Needles Regional Museum (3) 4.7 mi. History Museums. 12 Reviews 1 Q&A. Spirit Mountain Casino is 24-Hour Vegas-Style Casino located in Mohave Valley, Arizona. The casino has your favorite slot machines, video keno, video poker and a rewarding Players Club. Spirit Mountain Casino has an excellent restaurant open for breakfast, lunch and dinner. Spirit Mountain Casino is the locals casino!

Output (to STDOUT):

Example: Interactive

To run the code, launch the shell, and to accept interactive input from the shell:

Assuming a parking lot with n=6 slots, the following commands should be run in sequence by typing them in at a prompt and should produce output as described below the command. Note that exit Darwin casino restaurants buffet. terminates the process and returns control to the shell.

Repository

The repository contains the following:

  • Golang solution code

Learning Outcome

At the end of this project, we should be able to:

  • solve the Parking Lot problem with data structures optimized for complexity
  • write comprehensive unit tests in Golang
  • perform functional testing in Golang
  • utilize heap, hash map, and slice, data structures in Go
  • pretty print slices, arrays, and strings, using an interface

Instructions

  1. Setup Go
    • Install Go following the instructions here.
    • Set GOROOT which is the location of your Go installation. Assuming it is installed at $HOME/go2.x, execute:
    • Set GOPATH environment variable which specifies the location of your Go workspace. It defaults to $HOME/go on Unix/Linux.
    • Set GOBIN path for generation of binary file when go install is run.
  2. Source code
    • Git clone the project into $GOPATH/src/parking_lot folder in your computer.

      Here, git clone syntax follows the pattern: git clone .

  3. Executable
    • To create an executable in the $GOPATH/bin/ directory, execute
  4. Unit test and functional test
    • To run complete test suite, run

      Here, -v is the verbose command flag.

    • To run specific test, run

      Here, xxx is the name of test function.

    • Test coverage: 94.1% of statements
  5. Running
    • Launch interactive user input mode by executing
    • Launch file input mode by executing

      Here, $GOPATH/src/parking_lot/inputFile.txt refers to the input file with complete path.

Project structure

The project structure is as follows:

Notes on solution

  1. Data structures
    • A hash map and a min heap was used to solve the parking lot problem.
  2. Complexity
    • To park a car: O(log(n1)). Here, n1 is the size of the min heap.
    • To remove a car: O(log(n1)). Here, n1 is the size of the min heap.
    • To retrieve a car by colour: O(n2). Here, n2 is the size of the hash map.
    • To retrieve a car by registration number: O(n2). Here, n2 is the size of the hash map.
    • To get status: O(n2). Here, n2 is the size of the hash map.
  3. Assumptions and rationale for choice of data structures to optimize complexity
    • Car parking and removing operations will be more frequent compared to retrieving car by colour/registration number or status requests.
    • A hash map with slot number as key is used to store all the cars parked in the carpark. Complexity O(1) of hash map simplifies insertion and removal of cars by slot number.
    • A min heap is used to store previoulsy-occupied-but-now-empty slots in ordered sequence with complexity O(log(n1)) for push and pop operations. Here, empty slots n1 refer only to slots which were previously occupied but is now free. It does not refer to the total number of free slots in the carpark.
  4. Alternative solutions to reduce complexity at the expense of increased memory
    • To achieve complexity O(1) in retrieving a car by colour, implement an additional hash map with colour as key to store all the cars parked in the carpark.
    • To achieve complexity O(1) in retrieving a car by registration number, implement an additional hash map with registration number as key to store all the cars parked in the carpark.

Parking Slot Detection Github Tool

Code Refactoring

Parking slot detection github tool

Parking Slot Detection Github Software

This code refactoring problem is provided as an exercise for the readers.

Parking Slot Detection Github Failed

Thanks to you, Mr Zorro's multi­storey parking lot is functioning efficiently. Mr Zorro has now expanded his business by building two additional multistorey parking lots in adjacent plots of land. The multistorey parking lots are numbered in an increasing order (i.e., 1, 2, 3, etc). He needs your help to refactor your original ticketing system to manage all three multistorey parking lots.

  1. The expanded ticketing system should provide the same ability to determine
    • registration numbers of all cars of a particular colour,
    • slot number in which a car with a given registration number is parked, and
    • slot numbers of all slots where a car of a particular colour is parked,

    across all three parking lots. For example, the query slot_numbers_for_cars_with_colour white should return all white cars irrespective of the parking lot they are parked in.

  2. The expanded ticketing system should distribute customers among the three parking lots following either one of two rules. The ticketing system should accept rule changes dynamically during operation.
    • Rule A - Even Distribution: Vehicles are evenly distributed among the three parking lots based on the their occupancy rate. Occupancy rate is defined as percentage of parking slots filled within a multistorey parking lot. Multistorey parking lot with lower occupancy rate is filled first. If multiple multistorey parking lots have the same occupancy rate, the lowest numbered multistorey parking lot is chosen.
    • Rule B - Sequential Allocation: Vehicles are assigned to the lowest numbered multistorey parking lot which has available parking slots. That is to say, vehicles fill up multistorey parking lot 1 before filling parking lot 2, and parking lot 2 is filled before parking lot 3.
  3. Remember that each customer should still be allocated the nearest available parking slot to the entry point within the multistorey parking lot to which they were assigned to.

  4. Vehicle registration number (i.e., number plate) and colour are noted upon ticket issuance. Upon exiting the parking lot, the customer returns the ticket which marks their previously allocated lot as now available.

Example

The following commands run in sequence should produce output as shown below:

InputOutput
create_parking_lot 5Created a parking lot with 5 slots
create_parking_lot 3Created a parking lot with 3 slots
create_parking_lot 6Created a parking lot with 6 slots
dispatch_rule even_distributionDispatcher is now using the Even Distribution rule
The Parking Lot Problem: A Google Interview Question for Software Engineers.
Extension
intro.txt
Slot

When a vehicle enters the parking lot, its vehicle registration number (i.e., number plate) and colour are noted. Then, an available parking slot is allocated. Following are the rules of parking slot ticket issuance:

  • Each customer should be allocated the nearest available parking slot to the entry point.
  • Upon exiting the parking lot, the customer returns the ticket which marks their previously allocated lot as now available.
  • The system should provide the ability to determine:
    • Registration numbers of all cars of a particular colour.
    • Slot number in which a car with a given registration number is parked.
    • Slot numbers of all slots where a car of a particular colour is parked.

The ticketing system should be operable via two modes of input, namely, interactive commands and commands from a file. In other words, the ticketing system should be an executable which accepts:

  1. Interactive commands from an interactive command prompt shell
  2. A filename as an input argument at the command prompt and executes the commands from the given file

Example below includes all the commands which need to be supported.

Example: File Input

To run the code so it accepts input from a file:

People are seen Friday, Sept. 25, 2015, near the Haggen store at 1940 Village Center Circle in western Las Vegas. The company plans to leave the Nevada market as well as the Pacific Southwest. 2 visitors have checked in at Kegelcasino Hagen. Kegel casino hagen golf. Kegel- und Bowlingzentrum Hagen. Das Kegelzentrum Hagen - seit unter neuer Leitung. Frisch renoviert und attraktiver als jemals zuvor - Kegel- und Bolingzentrum Hagen. Kegel takes a shower while Darren and Molly are at the movies. Movie 56,784 Views (Ages 13+) kegel: in my day by jato. Kegel and Argus hang out on a bench at the park. Movie 20,028 Views (Ages 13+) kegel: campfire chat by jato. Kegel and friends sit around a campfire and chat. Movie 43,233 Views. Recognized as the leading experts in lane maintenance, KEGEL is the official partner for all major governing bodies of bowling - ABF, ETBF, PABCON, USBC, and WTBA.

Input (contents of file):

Spirit mountain casino needles. TRIBAL OFFICES Location 500 Merriman Avenue Needles, CA 92363 p (760) 629-4591 f (760) 629-6144. Spirit Mountain Casino Requires Face Masks For Guests & Employees. As of 11/17/20 smoking is not allowed indoors or within 20 feet of any entrance. With the current rise in COVID-19 cases, Spirit Mountain Casino is implementing the temporary safety measure of making the entire casino facility non-smoking. This includes 20 feet from all. Spirit Mountain Casino and Mesquite Grill, Mohave Valley: Address, Phone Number, Spirit Mountain Casino and Mesquite Grill Reviews: 3.5/5. United States; Arizona (AZ) Mohave Valley; Things to Do in Mohave Valley; Spirit Mountain Casino and Mesquite Grill. Needles Regional Museum (3) 4.7 mi. History Museums. 12 Reviews 1 Q&A. Spirit Mountain Casino is 24-Hour Vegas-Style Casino located in Mohave Valley, Arizona. The casino has your favorite slot machines, video keno, video poker and a rewarding Players Club. Spirit Mountain Casino has an excellent restaurant open for breakfast, lunch and dinner. Spirit Mountain Casino is the locals casino!

Output (to STDOUT):

Example: Interactive

To run the code, launch the shell, and to accept interactive input from the shell:

Assuming a parking lot with n=6 slots, the following commands should be run in sequence by typing them in at a prompt and should produce output as described below the command. Note that exit Darwin casino restaurants buffet. terminates the process and returns control to the shell.

Repository

The repository contains the following:

  • Golang solution code

Learning Outcome

At the end of this project, we should be able to:

  • solve the Parking Lot problem with data structures optimized for complexity
  • write comprehensive unit tests in Golang
  • perform functional testing in Golang
  • utilize heap, hash map, and slice, data structures in Go
  • pretty print slices, arrays, and strings, using an interface

Instructions

  1. Setup Go
    • Install Go following the instructions here.
    • Set GOROOT which is the location of your Go installation. Assuming it is installed at $HOME/go2.x, execute:
    • Set GOPATH environment variable which specifies the location of your Go workspace. It defaults to $HOME/go on Unix/Linux.
    • Set GOBIN path for generation of binary file when go install is run.
  2. Source code
    • Git clone the project into $GOPATH/src/parking_lot folder in your computer.

      Here, git clone syntax follows the pattern: git clone .

  3. Executable
    • To create an executable in the $GOPATH/bin/ directory, execute
  4. Unit test and functional test
    • To run complete test suite, run

      Here, -v is the verbose command flag.

    • To run specific test, run

      Here, xxx is the name of test function.

    • Test coverage: 94.1% of statements
  5. Running
    • Launch interactive user input mode by executing
    • Launch file input mode by executing

      Here, $GOPATH/src/parking_lot/inputFile.txt refers to the input file with complete path.

Project structure

The project structure is as follows:

Notes on solution

  1. Data structures
    • A hash map and a min heap was used to solve the parking lot problem.
  2. Complexity
    • To park a car: O(log(n1)). Here, n1 is the size of the min heap.
    • To remove a car: O(log(n1)). Here, n1 is the size of the min heap.
    • To retrieve a car by colour: O(n2). Here, n2 is the size of the hash map.
    • To retrieve a car by registration number: O(n2). Here, n2 is the size of the hash map.
    • To get status: O(n2). Here, n2 is the size of the hash map.
  3. Assumptions and rationale for choice of data structures to optimize complexity
    • Car parking and removing operations will be more frequent compared to retrieving car by colour/registration number or status requests.
    • A hash map with slot number as key is used to store all the cars parked in the carpark. Complexity O(1) of hash map simplifies insertion and removal of cars by slot number.
    • A min heap is used to store previoulsy-occupied-but-now-empty slots in ordered sequence with complexity O(log(n1)) for push and pop operations. Here, empty slots n1 refer only to slots which were previously occupied but is now free. It does not refer to the total number of free slots in the carpark.
  4. Alternative solutions to reduce complexity at the expense of increased memory
    • To achieve complexity O(1) in retrieving a car by colour, implement an additional hash map with colour as key to store all the cars parked in the carpark.
    • To achieve complexity O(1) in retrieving a car by registration number, implement an additional hash map with registration number as key to store all the cars parked in the carpark.

Parking Slot Detection Github Tool

Code Refactoring

Parking Slot Detection Github Software

This code refactoring problem is provided as an exercise for the readers.

Parking Slot Detection Github Failed

Thanks to you, Mr Zorro's multi­storey parking lot is functioning efficiently. Mr Zorro has now expanded his business by building two additional multistorey parking lots in adjacent plots of land. The multistorey parking lots are numbered in an increasing order (i.e., 1, 2, 3, etc). He needs your help to refactor your original ticketing system to manage all three multistorey parking lots.

  1. The expanded ticketing system should provide the same ability to determine
    • registration numbers of all cars of a particular colour,
    • slot number in which a car with a given registration number is parked, and
    • slot numbers of all slots where a car of a particular colour is parked,

    across all three parking lots. For example, the query slot_numbers_for_cars_with_colour white should return all white cars irrespective of the parking lot they are parked in.

  2. The expanded ticketing system should distribute customers among the three parking lots following either one of two rules. The ticketing system should accept rule changes dynamically during operation.
    • Rule A - Even Distribution: Vehicles are evenly distributed among the three parking lots based on the their occupancy rate. Occupancy rate is defined as percentage of parking slots filled within a multistorey parking lot. Multistorey parking lot with lower occupancy rate is filled first. If multiple multistorey parking lots have the same occupancy rate, the lowest numbered multistorey parking lot is chosen.
    • Rule B - Sequential Allocation: Vehicles are assigned to the lowest numbered multistorey parking lot which has available parking slots. That is to say, vehicles fill up multistorey parking lot 1 before filling parking lot 2, and parking lot 2 is filled before parking lot 3.
  3. Remember that each customer should still be allocated the nearest available parking slot to the entry point within the multistorey parking lot to which they were assigned to.

  4. Vehicle registration number (i.e., number plate) and colour are noted upon ticket issuance. Upon exiting the parking lot, the customer returns the ticket which marks their previously allocated lot as now available.

Example

The following commands run in sequence should produce output as shown below:

InputOutput
create_parking_lot 5Created a parking lot with 5 slots
create_parking_lot 3Created a parking lot with 3 slots
create_parking_lot 6Created a parking lot with 6 slots
dispatch_rule even_distributionDispatcher is now using the Even Distribution rule
The Parking Lot Problem: A Google Interview Question for Software Engineers.
intro.txt
This question was found at https://www.careercup.com/question?id=5750868554022912
Suppose a row of parking lot with n spots, one of them is empty and n-1 spots are occupied with cars.
Only one operation is allowed: move one car from its position to the empty spot.
Given a initial order of cars and a final order, output steps needed to convert initial order to final oder with that operation.
Solution
This type of planning problem can be solved using the AI planning algorithm STRIPS.
Solution at:
http://stripsfiddle.herokuapp.com/?d=n8edpSRhwdgQP4fq8&p=HnYPMpoRm6zf5F6SG&a=BFS
Click 'Run' to see a demo of it running!
For a tutorial on STRIPS, see:
'Artificial Intelligence Planning with STRIPS, A Gentle Introduction'
http://www.primaryobjects.com/2015/11/06/artificial-intelligence-planning-with-strips-a-gentle-introduction/
problem1.txt
Problem 1
Start: {1 2 3 X 4 5}
End: {X 2 3 1 4 5}
Solution found in 1 steps!
1. move c1 s1 s4

Parking Slot Detection Github Download

problem2.txt
Problem 2
Start: {1 2 3 X 4 5}
End: {5 1 X 3 2 4}
Solution found in 6 steps!
1. move c1 s1 s4
2. move c5 s6 s1
3. move c4 s5 s6
4. move c2 s2 s5
5. move c1 s4 s2
6. move c3 s3 s4
tdomain.pddl
;; Suppose a row of parking lot with n spots, one of them is empty and n-1 spots are occupied with cars.
;; Only one operation is allowed: move one car from its position to the empty spot.
;; Given a initial order of cars and a final order, output steps needed to convert initial order to final order with that operation.
(define (domain parking)
(:requirements :strips :typing)
(:types car spot)
(:action move
:parameters (?c - car ?s1 - spot ?s2 - spot)
:precondition (and (vehicle ?c) (location ?s1) (location ?s2) (at ?c ?s1) (empty ?s2))
:effect (and (at ?c ?s2) (empty ?s1)) (not (empty ?s2)) (not (at ?c ?s1))
)
)

Parking Slot Detection Github Software

tproblem-1.pddl
(define (problem 123x56)
(:domain parking)
(:objects
c1 c2 c3 c4 c5 - car
s1 s2 s3 s4 s5 s6 - spot)
(:init (and (vehicle c1) (vehicle c2) (vehicle c3) (vehicle c4) (vehicle c5)
(location s1) (location s2) (location s3) (location s4) (location s5) (location s6)
(at c1 s1) (at c2 s2) (at c3 s3) (at c4 s5) (at c5 s6)
(empty s4))
(:goal (and (at c1 s4)))
)
tproblem-2.pddl
(define (problem 123x56to51x324)
(:domain parking)
(:objects
c1 c2 c3 c4 c5 - car
s1 s2 s3 s4 s5 s6 - spot)
(:init (and (vehicle c1) (vehicle c2) (vehicle c3) (vehicle c4) (vehicle c5)
(location s1) (location s2) (location s3) (location s4) (location s5) (location s6)
(at c1 s1) (at c2 s2) (at c3 s3) (at c4 s5) (at c5 s6)
(empty s4))
(:goal (and (at c5 s1) (at c1 s2) (at c3 s4) (at c2 s5) (at c4 s6)))
)

commented Jul 12, 2017

Thanks a lot for this solution. I guess you should contribute to the following post on this blog: https://www.cleveroad.com/blog/develop-an-advanced-parking-management-software-for-your-lot and I'm sure the editor will add your comments to the article

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment




broken image