2012年1月5日星期四

以圖找圖 code

1. query_by_image.php
2. arg_test.php

兩個檔案在執行前
請先注意要改最前面的 $PATH 這個參數 改成你當前的目錄位置
(需要可以透過網頁連到的目錄 ex. "public_html" or "htdocs"
 然後記得最後要有斜線!! )

目前丟進去的參數
可以是檔案名、也可以是目錄的名稱, 我會自動去判斷


然後分別講一下要注意的事情:

To 李勻學姐:
之後可以直接用 [query_by_image.php] 這個檔案
但目前如果只是要測試 你的matlab code有沒有真的呼叫到我的程式
可以用 [arg_test.php] 這個檔案就好 他會印出你丟進去的檔案名稱 or 你丟進去的目錄名內 所有的檔案名稱
(因為第一個會去抓google的資料 有時會很慢= ="")

---------------

To 小飛俠:
[query_by_image.php] 這個code裡
中間我有寫一個會輸出 log.txt 的檔案  如果你有需要看query後到底出現哪些網頁可以打開來跑XD

然後比較需要注意的應該是 JSON 格式那邊
我會傳給你 $js 這個變數

$ar = array(
                        'has_same' => 1,
                        'Sim' => $matches1[1],
                        'Same' => $matches2[1]
                );
$js = json_encode($ar);

你可以從 'has_same' 這裡判斷有沒有相同的圖片
基本上要先用 json_decode()   //$json = json_decode($js);
然後就可以用decode出來的變數 去讀取裡面的檔案  
$json->has_same   //讀取 'has_same' 這個變數
$json->Sim[0]        //讀取 'Sim' 裡面的第一個參數

讀取的方式我有在下面寫個 test 你可以參考一下:)

2012年1月3日星期二

PHP的問題?

如果要使用原始碼是YIQ_hist2.m這個版本,

HW1的八個測試data放在images資料夾中,可以回目錄看,
也可以增加新的data資料夾,會自己抓圖片數目,不過編號需要從0開始。
有些資料夾已經有跑出來的結果了,可以測試看看~

str='02'; 這邊輸入影片分解後圖片所在的資料夾。

要傳三張圖所以增加以下程式碼。

%將圖片結果路徑當作參數以便php後續處理
path1=['images/',str,'/shots/keyframe-1.jpg'];
command1=['php query_by_image.php ' path1]; %command='php test.php for_test_path'
path2=['images/',str,'/shots/keyframe-2.jpg'];
command2=['php query_by_image.php ' path2]; %command='php test.php for_test_path'
path3=['images/',str,'/shots/keyframe-3.jpg'];
command3=['php query_by_image.php ' path3]; %command='php test.php for_test_path'

system(command1);
system(command2);
system(command3);

目前在工作站上試跑的結果是

r99922107@linux5:~/htdocs/MMAI/FinalProject> php query_by_image.php http://tinyurl.com/88tdd4d

Arg #1: http://tinyurl.com/88tdd4d

!!!!!!!is file!!!!!!!
##### Filename: http://tinyurl.com/88tdd4d #####
PHP Notice: Undefined offset: 1 in /nfs/master/99/r99922107/htdocs/MMAI/FinalProject/query_by_image.php on line 137
PHP Warning: file_get_contents(): Filename cannot be empty in /nfs/master/99/r99922107/htdocs/MMAI/FinalProject/query_by_image.php on line 43
No matching!!!
PHP Notice: Undefined offset: 1 in /nfs/master/99/r99922107/htdocs/MMAI/FinalProject/query_by_image.php on line 63
Visually similar images:

### for test ###
just has similar image...
Sim[0]:
PHP Notice: Undefined offset: 0 in /nfs/master/99/r99922107/htdocs/MMAI/FinalProject/query_by_image.php on line 123

這樣不知道算不算正常結果? @@"

稍微更新

原本是從直方圖中選取前10高的圖片作為場景的key frames,
再從這10張圖片去計算每個場景的時間長度,取前3長的作為影片的代表frames以供搜尋用。
以HW1的05影片-艾薇兒去試跑的結果如下:

keyframe-1


keyframe-2


keyframe-3


丟進去Google圖片搜尋的結果: 1、2找不到,3雖然沒有完全一樣的圖片但推估結果是正確的。
試著把一開始抓取的場景數量改為20個之後,取得的前3長間距的代表frames改變了,
新的結果如下:

keyframe-1


keyframe-2


keyframe-3


將新的代表frames丟入Google圖片搜尋,1和2都可以預估正確,整體結果有提升。

2011年12月11日星期日

老師建議閱讀的文章

Scalable Mobile Video Question-Answering System
with Locally Aggregated Descriptors and Random Projection
http://tinyurl.com/7df3e5n

建議事項:
(1)可以試著用youtube的相關影片來提高正確性
(2)control dataset避免找不到圖片
(3)evaluation可以用MAP

2011年12月8日星期四

Final Project - Proposal

- Team Member
R99922107 李勻
R00944020 曾奕翔
R00921049 周怡廷

– Problem definition
We want to automatically add tags or descriptions to videos.
Summary for video is also possible

– Possible approaches
1. Using shot detection to extract some key frames.
2. Using google search to find the most familiar picture of the key frames.
3. Extract the text description from the results by using TF IDF or other feature.
4. A problem we need to solve is If we can't find any pictures familiar enough to all the query,
this approach may fail.

features:
1. Color histogram 2. Texture

– Possible evaluation methods
We can collect several different type videos, and for each type we examine whether the
labels our program generated are related or not. Since it is hard to know how many tags are
related to the video, we may focus on precision of our result.