This file contains hidden or 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
\section{Experiment} | |
Our fine-tuning takes an already learned model: BVLC CaffeNet Model. CaffeNet is modified by AlexNet. This model is the result of Caffnet training on ImageNet. We set the result of fine-tuning as our baseline. | |
We use the dataset from Microsoft: Clickture-FilteredDog. This is a subset of the Clickture-Full dataset which only contains the dog breed related items. We pick out 107 class of this subset which contains more than 100 images total 89,910 images. We use 5-fold to split this dataset: 7,1932 images for training and 17,978 for testing. | |
Our result on Clickture-FilteredDog in Table 1 and Table 2. Our network achieves accuracy of \textbf{50.5\%}. The best performance with fine-tuning is 46.2\%. | |
In Table 1, the result of our first approach, average vector, does not exceed baseline(fine-tuning). Our MMD loss does not fall down after 7000? iterations, so we consider that average reduces some information in text such that the performance do not better than fine-tuning. Form t-SNE algorith |
This file contains hidden or 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
\begin{table}[t!] | |
\centering | |
\caption{Example of correct and fail cases.} | |
\label{table:dog_compare} | |
\begin{adjustbox}{max width=90mm} | |
\begin{tabular}{|l|>{\centering\arraybackslash}m{2in}|} | |
\hline | |
& \quad \quad Border Collie \newline \raisebox{-\totalheight}{\includegraphics[scale=0.2]{correction_border_collie}} \vfill \\ \hline | |
baseline & \quad \quad Australian Shepherd \newline \raisebox{-\totalheight}{\includegraphics[scale=0.2]{correction_australian_shepherd_1}} \vfill \\ \hline |
This file contains hidden or 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
//Java | |
public static String ParsingHost() throws Exception { | |
String url = "http://www.cna.com.tw/news/aloc/201710030325-1.aspx"; | |
URL aURL = new URL(url); | |
String host = aURL.getHost(); | |
return host; | |
} |
This file contains hidden or 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
// JAVA | |
public static void parsing() throws exception { | |
string url = "http://www.cna.com.tw/news/aloc/201710030325-1.aspx"; | |
document doc = jsoup.connect(url) | |
.header("user-agent", "mozilla/5.0 (linux; android 7.0; samsung sm-g950u build/nrd90m) applewebkit/537.36 (khtml, like gecko) samsungbrowser/5.2 chrome/51.0.2704.106 mobile safari/537.36") | |
.get(); | |
string target = "div.news_article"; | |
string remove = "script, button"; |
This file contains hidden or 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
//JAVA | |
public static void AddDocHead(Elements doc) throws Exception { | |
Element head = doc.first(); | |
head.prepend("<style>.article-header{content: '';background: linear-gradient(to top, #000 1rem,#fff 40rem,#fff 100%);height: 35rem;display: block;}.main-image{width: 100%;max-height: 700px;opacty: 0.9}.article-content{background-color: #fff;position: absolute;width: 90%;z-index: 1;margin-left: 4%; margin-right: 5%;margin-top: -2rem;font-size: 25px; padding-left: 5px; padding-right: 5px}.article-header:after {content: '';background: #000;background: -moz-linear-gradient(top, #000 28%, #fff 58%, #fff 100%);background: -webkit-linear-gradient(top, #000 22rem,#fff 40rem,#fff 100%);background: linear-gradient(to bottom, #000 22rem,#fff 40rem,#fff 100%);height: 40rem;display: block;} .article-content img{width: 100%}</style>"); | |
} | |
public static void Parsing() throws Exception { | |
String url = "http://www.cna.com.tw/news/aloc/201710030325-1.aspx"; | |
Document doc = Jsoup.connec |
This file contains hidden or 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
// Java | |
//without image url | |
public static void AddDocHead(Elements doc) throws Exception { | |
Element head = doc.first(); | |
head.prepend("<style>.article-header{content: '';background: linear-gradient(to top, #000 1rem,#fff 40rem,#fff 100%);height: 5rem;display: block;}.main-image{width: 100%;max-height: 700px;opacty: 0.9}.article-content{background-color: #fff;position: absolute;width: 90%;z-index: 1;margin-left: 4%; margin-right: 5%;margin-top: -2rem;font-size: 25px; padding-left: 5px; padding-right: 5px}.article-header:after {content: '';background: #000;background: -moz-linear-gradient(top, #000 28%, #fff 58%, #fff 100%);background: -webkit-linear-gradient(top, #000 22rem,#fff 40rem,#fff 100%);background: linear-gradient(to bottom, #000 22rem,#fff 40rem,#fff 100%);height: 40rem;display: block;} .article-content img{width: 100%} div{white-space: pre-wrap; white-space: -moz-pre-wrap; word-wrap: break-word;}</style>"); | |
} | |
// with image url | |
public static void AddDocHead(Elements |
This file contains hidden or 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
public static String AddDocHead(String s) throws Exception { | |
String _s = "<style> .article{padding-left: 18px;padding-right: 18px;padding-top: 15px;word-break: break-all}.article-header{font-size: 27px;color: #1a1a1a}.article-info{font-size: 16px;color: #c2c2c2;margin-top: 18px;margin-bottom: 18px}.article-content{margin-top: 18px;font-size: 22px;color: #818181}.main-image{width: 100%;max-height: 500px;margin-top: 20px;margin-bottom: 20px}hr{margin-top: 20px;color: #f5f5f5} img{width: 100%}</style>".concat(s); | |
return _s; | |
} | |
public static void Parsing() throws Exception { | |
String url = "http://www.cna.com.tw/news/aloc/201710030325-1.aspx"; | |
Document doc = Jsoup.connect(url) |
This file contains hidden or 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
def lower_df(df): | |
pattern = re.compile('\W+') | |
for field in ['name', 'category_name', 'brand_name', 'item_description']: | |
_str = list(map( | |
lambda x: re.sub(pattern, ' ', x), | |
df[field].str.lower() | |
)) | |
df[field] = _str |
This file contains hidden or 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
def forward(self, feature): | |
for f in feature: | |
f = torch.from_numpy(f) | |
f = f.float() | |
lstm_out, self.hidden = self.lstm( | |
f.view(1, 1, len(f)), self.hidden) | |
tag_space = self.hidden2tag(lstm_out.view(1, self.hidden_dim)) | |
tag_scores = F.log_softmax(tag_space, dim=1) |
This file contains hidden or 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
class Solution: | |
# 0<= value <= 100 | |
base = 101 | |
# leetcode popular prime number | |
p = 10 ** 9 + 7 | |
def findLength(self, nums1: List[int], nums2: List[int]) -> int: | |
l = 0 | |
r = min(len(nums1), len(nums2)) | |
OlderNewer