Linked List Cycle
141. Linked List Cycle
Solutions
Solution 1: Use set to memorize visited node.
Extra space
Solution 2: Make visited node pointed to itself.
No extra space
Break original structure
Reverse Linked List
206. Reverse Linked List
Solutions
Solution 1: Iterative
def reverseList(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
if head == None:
return head
next = head.next
last = None
while head!=None:
tmp = head.next
head.next = last
last = head
head = tmp
return last
Solution 2: Re...
Image Alignment
Image Alignment
Template matching
Slow, combinatory, global solution
Multi-scale template matching
Faster, combinatory, locally optimal
Local refinement based on some initial guess
Fastest, locally optimal
Translation: $\begin{bmatrix}x+p_1 \\ y + p_2\end{bmatrix} = \begin{bmatrix}1 & 0 & ...
Motion Estimation
Feature Matching
Object Detection
scoring
Feature matching across pairs of images and not feature detection (e.g. cornerness score). A lower score is a better match, since we use distance measure for comparison.
Higher -> more likely to be an object
threshold
Keep matches i...
Recognition
Feature Matching
An object as a collection of bag of features
deals well with occlusion
scale invariant
rotation invariant
position of parts is not important
Works well for object instances
Not great for generic object categories
Pros
Simple
Efficient algorithms
Robust to deformations
Cons
No spatial reasoning
Ba...
Image Descriptors
Image Descriptors
Represent surrounding region mathematically
Color histogram
Mean dy/dx values
Texton histograms
Feature Descriptors should be
Invariant: shouldn’t change even if image is transformed
Discriminative: should be highly unique for each point
Raw Image Patch: Intensity
Not invariant to geometry and appearance cha...
Local Features
Local Features
Interest point detection
keypoint detection, feature detection
Characteristics of Good Features
Repeatable
The same feature can be found in several images despite geometric and photometric
transformations
Distinct
Captures recognizably different information that allows it to be distinguished
...
Customizing Authentication
Customizing Authentication
Django maintains a list of “authentication backends” that it checks for authentication. When somebody calls django.contrib.auth.authenticate(), Django tries authenticating across all of its authentication backends with lazy evaluation.
Therefore, the order of authentication backend matters.
Django’s default authenti...
199 post articles, 25 pages.