|
SOMHunter Core
|
The main C++ API of the SOMHunter Core. More...
#include <somhunter.h>

Public Member Functions | |
| Somhunter ()=delete | |
| Somhunter (const std::string &config_filepath) | |
| The main ctor with the config from the JSON config file. More... | |
| GetDisplayResult | get_display (DisplayType d_type, FrameId selected_image=0, PageId page=0, bool log_it=true) |
| Returns display of the desired type. More... | |
| std::vector< bool > | like_frames (const std::vector< FrameId > &new_likes) |
| Inverts the like states of the provided frames and returns the new states. More... | |
| std::vector< bool > | bookmark_frames (const std::vector< FrameId > &new_bookmarks) |
| (De)selects the provided frames from the bookmark list. More... | |
| std::vector< const Keyword * > | autocomplete_keywords (const std::string &prefix, size_t count=5) const |
| Returns the nearest supported keyword matches to the provided prefix. More... | |
| RescoreResult | rescore (Query &query, bool benchmark_run=false) |
| Applies all algorithms for score computation and updates context. More... | |
| const UserContext & | switch_search_context (size_t index, size_t src_search_ctx_ID=SIZE_T_ERR_VAL, const std::string &screenshot_fpth="", const std::string &label="") |
| Switches the search context for the user to the provided index in the history and returns reference to it. More... | |
| const SearchContext & | get_search_context () const |
| Returns a reference to the current user's search context. More... | |
| const UserContext & | get_user_context () const |
| Returns a reference to the current user's context. More... | |
| const VideoFrame & | get_frame (FrameId ID) const |
| FrameRange | get_frames (VideoId video_ID, FrameNum fr, FrameNum to) const |
| VideoFramePointer | get_frame_ptr (FrameId img) const |
| bool | som_ready () const |
| Returns true if the user's SOM is ready. More... | |
| bool | som_ready (size_t temp_id) const |
| void | reset_search_session () |
| Resets current search context and starts new search. More... | |
| bool | login_to_eval_server () |
| Tries to login into the remote evaluation server (competition one). More... | |
| bool | logout_from_eval_server () |
| Tries to logout from the remote evaluation server (competition one). More... | |
| SubmitResult | submit_to_eval_server (FrameId frame_id) |
| Sumbits frame with given id to VBS server. More... | |
| void | log_video_replay (FrameId frame_ID, float delta_X) |
| void | log_scroll (DisplayType t, float delta_Y) |
| void | log_text_query_change (const std::string &text_query) |
| void | log_canvas_query_change () |
| std::string | store_rescore_screenshot (const std::string &filepath) |
| size_t | get_num_frames () const |
| const std::vector< FrameId > & | get_top_scored (size_t max_count=0, size_t from_video=0, size_t from_shot=0) const |
| std::vector< VideoFramePointer > | get_top_scored_frames (size_t max_count=0, size_t from_video=0, size_t from_shot=0) const |
| std::vector< float > | get_top_scored_scores (std::vector< FrameId > &top_scored_frames) const |
| size_t | find_targets (const std::vector< FrameId > &top_scored, const std::vector< FrameId > &targets) const |
| const Settings & | settings () const |
| const std::string & | get_config_filepath () |
| const std::string & | get_API_config_filepath () |
| const KeywordRanker * | textual_model () |
| void | benchmark_native_text_queries (const std::string &queries_filepath, const std::string &out_dir) |
| void | benchmark_canvas_queries (const std::string &queries_dir, const std::string &out_dir) |
| void | benchmark_real_queries (const std::string &queries_dir, const std::string &targets_fpth, const std::string &out_dir) |
| void | generate_example_images_for_keywords () |
| Generates the top example images from the database for all supported W2VV keywords. More... | |
| void | run_basic_test () |
| void | run_generators () |
Static Public Member Functions | |
| static void | write_resultset (const std::string &file, const std::vector< VideoFramePointer > &results) |
| static void | write_query (const std::string &file, const Query &q) |
| static void | write_query_info (const std::string &file, const std::string &ID, const std::string &user, const std::tuple< VideoId, FrameId, FrameId > &target, std::size_t pos_vid, std::size_t pos_fr, std::size_t unpos_vid, std::size_t unpos_fr) |
Private Member Functions | |
| void | apply_filters () |
| void | generate_new_targets () |
| Generates the new debug targets. More... | |
| template<typename SpecificKWRanker , typename SpecificFrameFeatures > | |
| void | rescore_keywords (SpecificKWRanker &kw_ranker, const TextualQuery &query, size_t temporal, const SpecificFrameFeatures &features) |
| Applies text query from the user. More... | |
| void | rescore_feedback () |
| Applies the relevance feedback from the user based on images the user already saw (as implicit negative examples). More... | |
| void | som_start (size_t temporal) |
| Gives the SOM worker the new work. More... | |
| FramePointerRange | get_random_display () |
| FramePointerRange | get_topn_display (PageId page) |
| FramePointerRange | get_topn_context_display (PageId page) |
| FramePointerRange | get_som_display () |
| FramePointerRange | get_som_relocation_display (size_t temp_id) |
| FramePointerRange | get_video_detail_display (FrameId selected_image, bool log_it=true) |
| FramePointerRange | get_topKNN_display (FrameId selected_image, PageId page) |
| FramePointerRange | get_page_from_last (PageId page) |
| void | reset_scores (float val=1.0F) |
| void | push_search_ctx () |
| Adds the currently active search context to the history and starts a new context (with next contiguous ID number) More... | |
| bool | has_metadata () const |
| Returns true if LSC metadata file provided inside the config. More... | |
Private Attributes | |
| const Settings | _settings |
| Current application settings. More... | |
| const DatasetFrames | _dataset_frames |
| const DatasetFeatures | _dataset_features |
| UserContext | _user_context |
| const std::string | _core_settings_filepath |
| const std::string | _API_settings_filepath |
| KeywordRanker | _keyword_ranker |
| KeywordClipRanker | _secondary_keyword_ranker |
| CanvasQueryRanker | _collage_ranker |
| const RelocationRanker | _relocation_ranker |
The main C++ API of the SOMHunter Core.
Every comunication from the outside world goes through this API. This API can be called directly from other C++ code or can be called by the HTTP API provided inside class NetworkApi.
|
delete |
| Somhunter::Somhunter | ( | const std::string & | config_filepath | ) |
The main ctor with the config from the JSON config file.

|
private |

| std::vector< const Keyword * > Somhunter::autocomplete_keywords | ( | const std::string & | prefix, |
| size_t | count = 5 |
||
| ) | const |
Returns the nearest supported keyword matches to the provided prefix.

| void Somhunter::benchmark_canvas_queries | ( | const std::string & | queries_dir, |
| const std::string & | out_dir | ||
| ) |

| void Somhunter::benchmark_native_text_queries | ( | const std::string & | queries_filepath, |
| const std::string & | out_dir | ||
| ) |

| void Somhunter::benchmark_real_queries | ( | const std::string & | queries_dir, |
| const std::string & | targets_fpth, | ||
| const std::string & | out_dir | ||
| ) |

| std::vector< bool > Somhunter::bookmark_frames | ( | const std::vector< FrameId > & | new_bookmarks | ) |
(De)selects the provided frames from the bookmark list.

| size_t sh::Somhunter::find_targets | ( | const std::vector< FrameId > & | top_scored, |
| const std::vector< FrameId > & | targets | ||
| ) | const |
| void Somhunter::generate_example_images_for_keywords | ( | ) |
Generates the top example images from the database for all supported W2VV keywords.
For examples used as keyword-to-ID.W2VV-BoW.csv file.

|
private |
Generates the new debug targets.

|
inline |
|
inline |
| GetDisplayResult Somhunter::get_display | ( | DisplayType | d_type, |
| FrameId | selected_image = 0, |
||
| PageId | page = 0, |
||
| bool | log_it = true |
||
| ) |
Returns display of the desired type.
Some diplays may even support paging (e.g. DISP_TOP_N) or selection of one frame (e.g. DISP_KNN).

| const VideoFrame & Somhunter::get_frame | ( | FrameId | ID | ) | const |

| VideoFramePointer Somhunter::get_frame_ptr | ( | FrameId | img | ) | const |

| FrameRange Somhunter::get_frames | ( | VideoId | video_ID, |
| FrameNum | fr, | ||
| FrameNum | to | ||
| ) | const |

|
inline |

|
private |

|
private |

| const SearchContext & Somhunter::get_search_context | ( | ) | const |
Returns a reference to the current user's search context.
|
private |

|
private |

| const std::vector< FrameId > & Somhunter::get_top_scored | ( | size_t | max_count = 0, |
| size_t | from_video = 0, |
||
| size_t | from_shot = 0 |
||
| ) | const |

| std::vector< VideoFramePointer > Somhunter::get_top_scored_frames | ( | size_t | max_count = 0, |
| size_t | from_video = 0, |
||
| size_t | from_shot = 0 |
||
| ) | const |

| std::vector< float > Somhunter::get_top_scored_scores | ( | std::vector< FrameId > & | top_scored_frames | ) | const |
|
private |

|
private |

|
private |

| const UserContext & Somhunter::get_user_context | ( | ) | const |
Returns a reference to the current user's context.
|
private |

|
private |
Returns true if LSC metadata file provided inside the config.
| std::vector< bool > Somhunter::like_frames | ( | const std::vector< FrameId > & | new_likes | ) |
Inverts the like states of the provided frames and returns the new states.

| void Somhunter::log_canvas_query_change | ( | ) |

| void Somhunter::log_scroll | ( | DisplayType | t, |
| float | delta_Y | ||
| ) |

| void Somhunter::log_text_query_change | ( | const std::string & | text_query | ) |

| void Somhunter::log_video_replay | ( | FrameId | frame_ID, |
| float | delta_X | ||
| ) |

| bool Somhunter::login_to_eval_server | ( | ) |
Tries to login into the remote evaluation server (competition one).

| bool Somhunter::logout_from_eval_server | ( | ) |
Tries to logout from the remote evaluation server (competition one).

|
private |
Adds the currently active search context to the history and starts a new context (with next contiguous ID number)
| RescoreResult Somhunter::rescore | ( | Query & | query, |
| bool | benchmark_run = false |
||
| ) |
Applies all algorithms for score computation and updates context.
Returns references to existing history states that we can go back to (including the current one).

|
private |
Applies the relevance feedback from the user based on images the user already saw (as implicit negative examples).

|
private |
Applies text query from the user.
|
private |

| void Somhunter::reset_search_session | ( | ) |
Resets current search context and starts new search.

| void Somhunter::run_basic_test | ( | ) |

| void Somhunter::run_generators | ( | ) |
|
inline |
| bool Somhunter::som_ready | ( | ) | const |
Returns true if the user's SOM is ready.

| bool Somhunter::som_ready | ( | size_t | temp_id | ) | const |
|
private |
Gives the SOM worker the new work.

| std::string Somhunter::store_rescore_screenshot | ( | const std::string & | filepath | ) |
| SubmitResult Somhunter::submit_to_eval_server | ( | FrameId | frame_id | ) |
Sumbits frame with given id to VBS server.

| const UserContext & Somhunter::switch_search_context | ( | size_t | index, |
| size_t | src_search_ctx_ID = SIZE_T_ERR_VAL, |
||
| const std::string & | screenshot_fpth = "", |
||
| const std::string & | label = "" |
||
| ) |
Switches the search context for the user to the provided index in the history and returns reference to it.

|
inline |
|
static |

|
static |
|
static |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Current application settings.
|
private |