NOTE: FOR python3 only. np.arange(0.01,1.00,0.01) WRONG! -> 0.01,0.02,0.03000000001,... Just an example [i*0.01for i inrange(1,101)] WRONG! [i/100for i inrange(1,101)] RIGHT!
Features matter, the first sentence of RCNN paper.
Generalize the CNN classification results on ImageNet to object detection
BY
bridging the gap beween image classification and object detection.
Modules description
Region proposals generation: Selective search
generating category-independent region proposals. Use Selective search ( a traditional machine learning method).
1 2 3 4 5 6 7 8 9 10 11 12 13 14
Input: image Return: a set of proposals
Regions Initializer: R = {r1,r2...} for each ri, rj in R: cal similarity of i,j: s(ri,rj) S = S and s(ri,rj) while S not empy: get s_max= s(ri,rj) rt = ri + rj remove s(r*,r*) including ri and rj S = S and St R = R and rt return bounding box of each region in R
Feature extraction
Proposal transformation
tightest square with context (context for fulfill 227,227)(context:前后关系。此处意为proposal再图像里的左右部分 )
tightest square without context
Resize and zero padding
Train:
Positive data: proposals with IOU > 0.5 and Ground Truth labels
Negative data: proposals with IOU < 0.5
A CNN model.
Input: $(227,227,3)$
Output features: $(4096)$
Class-specific linear SVMs (class independently)
For each proposal, SVM generates an expected class and corresponding confidence. Final results only include proposals with IoU (Intersection of union) [Bounding box] overlap with a higher scoring selected region larger than a learned threshold(pretty important according to the paper).
Train:
Positive data: Ground Truth labels
Negative data: proposals with IOU < 0.3
Dropped data: proposals with IOU > 0.3 (Too much positive samples which do not emphasize precise localization)
Visualize method
Features
Use 10M+ images as input, for each feature unit, a output value will be generated. Then rank the 10M+ value and show images with corresponding top 10 values. (Speak for themselves)
[Each row indicates the result of each feature unit]
Ablation(切除)
Convolution layer has sufficient representational power of image. (更偏于原图)
Fc 更偏于 features. The fine-tuning of fc will benefit more because features of different tasks are different.(But the deep representation format of same image has no much difference)
Bounding box regression
Train
Positive data: Region proposal with biggest IOU and IOU > 0.6. ($P_x,P_y,P_w,P_h$)
In this section, I will introduce and justify my criteria and state my assumptions I make when designing this kind of criteria. Typically, fuzzy criteria will be highlighted.
The stock with highest PE in same type will be excluded. This criteria is inspired by the introduction of PE in the specification:
PE(Price-Earning Ratio) = Market price / EPS(earning per share). Usually lower is better, but it depends on the PE ratio of the similar stocks. (However, if some types contain only one stock in the database, then this special stock won’t be excluded.)
high buying level. High buying level means more stable and has less risk. The following is the corresponding fuzzy membership function.
Buying level
1
2
3
4
5
$\mu_{high_buy_lv}$
0.1
0.3
0.5
0.7
0.9
high difference. High difference level means that the stock may have more profit but also more risk. The following is the corresponding fuzzy membership function. However, the difference between ‘too high’ and ‘very high’ is not huge. Therefore the fuzzy memebership function is not linear.
Difference
0
25
50
75
100
125
150
175
200
225
250
$\mu_{high_diff}$
0.0
0.2
0.4
0.6
0.75
0.8
0.85
0.9
0.95
0.98
1.0
Query
This section is to introduce the query we design:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
STOCK_CLASS(NAME) (or ((and (= Type SEMI) (< PE 31)) (and (= Type WWW) (< PE 66.4)) (= Type TECH) (= Type FOOD) (= Type GAME) ) (and (High_BUY_LV (12345) (0.10.30.50.70.9)1) (High_DIFF_LV (0255075100125150175200225250) (0.00.20.40.60.750.80.850.90.950.981.0)1) )
Calculation
Non-fuzzy criteria
The stock with highest PE in same type will be excluded.
NAME
PRICE
ORIGI N
TYPE
PE
PE_LV
BUY_LV
DIFF
DIFF_LV
AAPL
167
US
TECH
18
1
4
33
2
TXN
110
US
SEMI
31
2
4
47
2
FB
187
US
WWW
35
2
5
43
2
MU
44
US
SEMI
7
1
5
80
3
BABA
205
CHN
WWW
55
4
5
101
4
KM
120
CHN
FOOD
39
3
4
220
5
SAMSUNG
2325
KOR
SEMI
9.53
1
4
25
1
NINTENDO
440
JPN
GAME
50
3
4
200
5
TENCENT
59
CHN
WWW
58
4
4
230
5
PYPL
85
US
WWW
66.4
5
3
90
4
Fuzzy criteria
high buying level and high difference level.
Name
Buying level
Difference level
Membership(min)
AAPL
$\mu_{high_buy_lv}(4) = 0.7$
$\mu_{high_diff}(33)=0.2$
0.2
FB
$\mu_{high_buy_lv}(5) = 0.9$
$\mu_{high_diff}(43)=0.2$
0.2
MU
$\mu_{high_buy_lv}(5) = 0.9$
$\mu_{high_diff}(80)=0.6$
0.6
BABA
$\mu_{high_buy_lv}(5) = 0.9$
$\mu_{high_diff}(101)=0.75$
0.75
KM
$\mu_{high_buy_lv}(4) = 0.7$
$\mu_{high_diff}(220)=0.95$
0.7
SAMSUNG
$\mu_{high_buy_lv}(4) = 0.7$
$\mu_{high_diff}(25)=0.2$
0.2
MINTENDO
$\mu_{high_buy_lv}(4) = 0.7$
$\mu_{high_diff}(200)=0.95$
0.7
TENCENT
$\mu_{high_buy_lv}(4) = 0.7$
$\mu_{high_diff}(230)=0.9$
0.7
Conclusion
Therefore, the system will select BABA to buy from our calculation.
an object in the real world that is distinguishable from other objects. ( can be same category)
described using a set of attributes.
Entity set is a collection of entities of the same type. All entities in a given entity set have the same attributes ( the values may be different).
Domain: domain of possible values of each attribute in an entity set.
Key
superkey: any set of attributes which can uniquely identify an entity
key (candidate key): a minimal set of attributes whose values can uniquely identify an entity in the set. (should depend on the real life possibility 即使还有entity 加入/删除, 这个key永远identify an entity)
primary key: a candidate key chosen to serve as the key for the entity set
Relationships
an association among two or more entities.
eg. Teach: (John,CENG4567) ,(David, CSCI1234)
relationship set: a set of similar relationships: {(John,CENG4567) ,(David, CSCI1234)}
relationships can also have descriptive attributes
SELECT S.sname FROM Sailors S, Reserves R WHERE S.sid=R.sid AND R.bid=103 = SELECT S.sname FROM Sailors S NATURALJOIN Reserves R WHERE R.bid=103
#IN operator SELECT B.bname FROM Boats B WHERE B.color IN (‘red’, ‘blue’, ’green’)
#Nested Queries Find names of sailors who’ve reserved boat #103: SELECT S.sname FROM Sailors S WHERE S.sid IN (SELECT R.sid FROM Reserves R WHERE R.bid=103) #innerfunction can use the relation inouterfunction >ANY : 比某一些大就行
Expressions and string
LIKE for string matching. _ = any one character, % = 0 or more arbitrary characters
Aggregate Operators
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
COUNT([DISTINCT] A) SUM ( [DISTINCT] A) AVG ([DISTINCT] A) MAX (A) MIN (A) A: anycolumnof a relation # cannot be netsted!MIN(AVG(A)) isnot allowed! eg.Find the name and age of the oldest sailor SELECT S.sname, S.age FROM Sailors S WHERE S.age = (SELECTMAX (S2.age) FROM Sailors S2) eg.Find the names of sailors who are older than the oldest sailor with a rating of10. SELECT S.name FROM Sailors S WHERE S.age > ( SELECTMAX (S2.age) FROM Sailors S2 WHERE S2.rating =10)
GROUP BY and Having
1 2 3 4 5 6 7 8 9 10
eg Find the age of the youngest sailor foreach rating level. SELECT S.rating, MIN (S.age) FROM Sailors S GROUPBY S.rating
SELECT [DISTINCT] target-list STEP 2//target list = attribute names + terms with ahhregate operations, The attribute names must be a subsetofgrouping-list. FROM relation-list STEP 1 WHERE qualification STEP 2 GROUPBYgrouping-list STEP3 HAVINGgroup-qualification STEP 4
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
SELECT R.day FROM Reserves R GROUPBY R.day HAVINGCOUNT(DISTINCT R.sid) =1
Example: Find the average age of sailors foreach rating level that has at least two sailors. SELECT S.rating, AVG(S.age) AS avgage FROM Sailor S GROUPBY S.rating HAVINGCOUNT (*) >1
Example:Find those ratings for which the average age is the minimum overall ratings SELECT Temp.rating, Temp.avgage FROM (SELECT S.rating, AVG (S.age) AS avgage FROM Sailors S GROUPBY S.rating) AS Temp WHERE Temp.avgage = (SELECTMIN (Temp.avgage) FROM Temp)
Division
CREATE VIEW
Delete view:DROP VIEW Temp
Outer Join
S LEFT OUTER JOIN R: S 中不对应 R的也会加进去。 只是R的field就是 NULL
There are hundreds of programming languages to use now, which make it difficult for programmers to decide which language is the most suitable for them.
Below picture (cited from Quora) also shows that many people, no matter they are experienced programmers or not, have the question:
Which programming language should I learn next?
Motivation
Motivated by the wide range of discussion: “ best programming language to learn” and our former hesitant experience when deciding which programming course to enroll, we decided to design a Fuzzy expert system to solve these kinds of problems.
Problem Definition
The users do not have a clear knowledge on different programming language, which make them hard to select the best/ most suitable programming language for them to learn.
System Design
The Fuzzy system is designed for recommending suitable programming languages for users to learn. And rules are provided for inference so that users need to answer some simple programming habits questions, which are used as facts in the system.
Implementation
Fuzzy type
Difficulty the expected difficulty of programming language.
Time the expected time spent to learn programming language every week.
Resource the expected learning resource of programming language.
Experience the former programming experience of the user.
Efficiency the expected efficiency of programming language.
Package the expected package(eg. numpy in python) requirements of programming language.
Debug the debugging ability and willing of user.
Objects
(conclusion)
preset values of the result
expectation_of_difficulty
time_spent_on_learning
available_resource
experience
package_requirement
efficiency_requirement
upset_when_debug
market_requirement
whether the reason user learns programming is for finding a job.
company_orientation
the expected IT companies the user wants to work for.
interest_field
the expected programming field the user wants to work in.
compiled_language_or_not
whether the user is suitable for compiled language or not.
Rules
Rules in the system is divided into two perspectives: Facts and languages.
For the facts perspective, the rules help to inference the conclusion and other objects such as expectation of difficulty by facts. Here are some examples:
1 2 3 4 5 6 7 8 9 10 11
RULE CODE:difficulty_rule_easy_111 IF time_spent_on_learning is little AND available_resource is little AND experience is little THEN expectation_of_difficulty is easy WITH CERTAINTY: 0.9 //help to inference expectation_of_difficulty
RULE CODE:difficulty_rule_1 IF expectation_of_difficulty is easy THEN programming_language is Python WITH CERTAINTY: 0.75 //help to inference programming_language
For the languages perspective, the rules help to inference the conclusion by languages, this kind of rule makes use of the key features of different programming language. Here is one example:
1 2 3 4
RULE CODE:js_rule_2 IF expectation_of_difficulty is easy AND efficiency_requirement is high AND interest_field is Web_programming THEN programming_language is Javascript WITH CERTAINTY: 0.95
Our system has done a basic programming language recommendation task, which covers almost all possibilities. And the result is really practical for uses.
However, the system can not solve a few specific language requirements well, such as Database programmer and so on.
Further improvements
According to what we mentioned above, the system can be still improved by importing more language-based rules so that the system can handle some specific language requirements better.