SOMHunter Core
sh Namespace Reference

Namespaces

 LOGGING_STRINGS
 
 sconfig
 
 tests
 
 utils
 

Classes

class  NotLoggedInEx
 
struct  DebugLogStreamPtrs
 
struct  UsedTools
 
struct  SubmitData
 
struct  FiltersData
 
class  BitmapImage
 Basic abstraction for images. More...
 
class  ImageManipulator
 Provides utilities for image manipulation and processing. More...
 
class  Http
 
class  Extractor
 
class  NetworkApi
 Class responsible for listening for HTTP requests and for handlling them using the core. More...
 
class  FrameFeatures
 Represents one set of features for the given dataset. More...
 
class  DatasetFeatures
 Represents all available feature sets. More...
 
struct  VideoFrame
 
struct  FrameRange
 Represents CONTINOUS range of frames. More...
 
class  FramePointerRange
 Represents CONTINOUS range of const frame pointers. More...
 
class  DatasetFrames
 
class  IServerClient
 Unified interface for all remote evaluation servers. More...
 
class  ClientDres
 Specific DRES server implementation. More...
 
class  EvalServerClient
 
class  TaskTargetHelper
 Represents a real competition task and for the given timestamp responds with the target. More...
 
class  Logger
 Class responsible for all the logging for the given user (each user have it's own Logger.) More...
 
class  WeekDaysFilter
 Container for information about days filtering. More...
 
struct  TimeFilter
 Container for information about time filtering. More...
 
struct  YearFilter
 Container for information about time filtering. More...
 
struct  Filters
 Container for all the available filters for the rescore. More...
 
struct  RescoreMetadata
 
struct  RelativeRect
 
class  CanvasSubqueryBase
 
class  CanvasSubqueryBitmap
 
class  CanvasSubqueryText
 
class  CanvasQuery
 Type representing query related to the canvas (atm text & bitmap) rectangles. More...
 
struct  TemporalQuery
 
struct  Query
 The type representing the whole query. More...
 
struct  BaseBenchmarkQuery
 
struct  PlainTextBenchmarkQuery
 
struct  CanvasBenchmarkQuery
 
class  CanvasQueryRanker
 
class  EmbeddingRanker
 
class  KeywordClipRanker
 
struct  Keyword
 
class  KeywordRanker
 
class  RelocationRanker
 
class  ScoreModel
 
struct  SearchContext
 Represents exactly one momentary state of a search session. More...
 
class  UserContext
 Represents exactly one state of ONE user that uses this core. More...
 
struct  GetDisplayResult
 Result type get_display returns. More...
 
struct  RescoreResult
 Result type rescore returns. More...
 
struct  TestsSettings
 Config needed by the Submitter instance. More...
 
struct  PresentationViewsSettings
 
struct  LoggerSettings
 
struct  ApiConfig
 
struct  EvalServerSettings
 
struct  RemoteServicesSettings
 
struct  ModelsSettings
 
struct  DatasetsSettings
 
struct  Settings
 Parsed current config of the core. More...
 
class  Somhunter
 The main C++ API of the SOMHunter Core. More...
 
class  AsyncSom
 
struct  dist_id
 

Typedefs

using UnixTimestamp = std::int64_t
 
using LogHash = std::string
 
using KeywordId = size_t
 
using KeywordIds = std::vector< KeywordId >
 
using KwSearchId = std::pair< KeywordId, size_t >
 
using KwSearchIds = std::vector< KwSearchId >
 
using KwDescription = std::string
 
using SynsetId = size_t
 
using SynsetStrings = std::vector< std::string >
 
using SynsetIds = std::vector< SynsetId >
 
using VideoId = unsigned
 
using FrameNum = unsigned
 
using ShotId = unsigned
 
using FrameId = unsigned long
 
using ScreenImgsCont = std::vector< FrameId >
 
using FeatureMatrix = std::vector< std::vector< float > >
 
using FeatureVector = std::vector< float >
 
template<typename T_ = float>
using StdMatrix = std::vector< std::vector< T_ > >
 
template<typename T_ = float>
using StdVector = std::vector< T_ >
 
using LikesCont = std::set< FrameId >
 
using BookmarksCont = std::set< FrameId >
 
using ShownFramesCont = std::set< FrameId >
 
using ScreenVideosCont = std::set< VideoId >
 
using PageId = unsigned
 
using Weekday = uint8_t
 
using Hour = uint8_t
 
using Year = uint16_t
 
using LscId = std::string
 
using ReqCode = std::size_t
 
using PrimaryFrameFeatures = FrameFeatures< DatasetsSettings::PrimaryFeaturesSettings >
 
using SecondaryFrameFeatures = FrameFeatures< DatasetsSettings::SecondaryFeaturesSettings >
 
using VideoFramePointer = const VideoFrame *
 
using ImageKeywords = KeywordRanker
 
using RelevanceFeedbackQuery = LikesCont
 
using TextualQuery = std::string
 
using RelocationQuery = FrameId
 
using CanvasSubquery = std::variant< CanvasSubqueryBitmap, CanvasSubqueryText >
 
using BenchmarkQuery = std::variant< PlainTextBenchmarkQuery >
 

Enumerations

enum class  SubmitResult { CORRECT , INCORRECT , NOT_LOGGED_IN }
 
enum class  DisplayType {
  DNull , DTopKNN , DLoading , DSom ,
  DEmbed , DTopN , DTopNContext , DRand ,
  DVideoDetail , DVideoReplay , DRelocation , NumItems
}
 
enum class  RequestType { GET , POST }
 

Functions

template<typename T_ >
constexpr T_ ERR_VAL ()
 Value indicating error/invalid/"NULL" value for the given type. More...
 
DisplayType str_to_disp_type (const std::string &type_str)
 
std::string disp_type_to_str (DisplayType type)
 
constexpr size_t operator""_z (unsigned long long int x)
 User defined size literal. More...
 
void require_value (const json &json, const std::string &msg="Missing JSON value")
 Makes sure that the given json is defined (not null and not undefined). More...
 
void require_key (const json &json, const std::string &key)
 Makes sure that the given json has the given key and the key is not null. More...
 
template<typename T_ >
T_ optional_value_or (const json &j, const std::string &key, const T_ &or_val)
 Parses the (potentialy null) value from the given key in JSON structure and if not defined or null uses the or_val value. More...
 
template<>
std::string optional_value_or (const json &j, const std::string &key, const std::string &or_val)
 Parses the (potentialy null) value from the given key in JSON structure and if not defined or null uses the or_val value. More...
 
template<typename T_ >
std::optional< T_ > optional_value (const json &j, const std::string &key)
 Parses the (potentialy null) value from the given key in JSON structure. More...
 
template<>
std::optional< std::string > optional_value (const json &j, const std::string &key)
 Parses the (potentialy null or empty) string from the given key in JSON structure. More...
 
json wrap_and_parse (std::stringstream &in_stream)
 
std::ostream & operator<< (std::ofstream &os, CanvasSubqueryBitmap x)
 
std::ostream & operator<< (std::ofstream &os, CanvasSubqueryText x)
 
template<typename DType >
std::vector< std::vector< DType > > to_std_matrix (const at::Tensor &tensor_features)
 
template<c10::ScalarType TensorDType_ = at::kFloat, typename OrigDType_ = float>
at::Tensor to_tensor (std::vector< OrigDType_ > &orig_vec)
 
template<c10::ScalarType TensorDType_ = at::kFloat, typename OrigDType_ = float>
at::Tensor to_tensor (std::vector< std::vector< OrigDType_ >> &orig_mat)
 
void fit_SOM (size_t, size_t k, size_t dim, size_t niter, const std::vector< float > &points, std::vector< float > &koho, const std::vector< float > &nhbrdist, const float alphasA[2], const float radiiA[2], const float alphasB[2], const float radiiB[2], const std::vector< float > &scores, const std::vector< bool > &, std::mt19937 &rng)
 
void map_points_to_kohos (size_t start, size_t end, size_t k, size_t dim, const std::vector< float > &points, const std::vector< float > &koho, std::vector< size_t > &mapping, const std::vector< bool > &present_mask)
 

Variables

constexpr int TOP_N_SELECTED_FRAME_POSITION = 2
 
constexpr float RANDOM_DISPLAY_WEIGHT = 3.0f
 
constexpr size_t SOM_DISPLAY_GRID_WIDTH = 8
 SOM window image grid width. More...
 
constexpr size_t SOM_DISPLAY_GRID_HEIGHT = 8
 SOM window image grid height. More...
 
constexpr size_t RELOCATION_GRID_WIDTH = 5
 SOM relocation grid width. More...
 
constexpr size_t RELOCATION_GRID_HEIGHT = 5
 SOM relocation grid height. More...
 
constexpr int MAX_TEMPORAL_SIZE = 2
 Maximal size of temporal query. More...
 

Typedef Documentation

◆ BenchmarkQuery

using sh::BenchmarkQuery = typedef std::variant<PlainTextBenchmarkQuery>

◆ BookmarksCont

using sh::BookmarksCont = typedef std::set<FrameId>

◆ CanvasSubquery

◆ FeatureMatrix

using sh::FeatureMatrix = typedef std::vector<std::vector<float> >

◆ FeatureVector

using sh::FeatureVector = typedef std::vector<float>

◆ FrameId

using sh::FrameId = typedef unsigned long

◆ FrameNum

using sh::FrameNum = typedef unsigned

◆ Hour

using sh::Hour = typedef uint8_t

◆ ImageKeywords

◆ KeywordId

using sh::KeywordId = typedef size_t

◆ KeywordIds

using sh::KeywordIds = typedef std::vector<KeywordId>

◆ KwDescription

using sh::KwDescription = typedef std::string

◆ KwSearchId

using sh::KwSearchId = typedef std::pair<KeywordId, size_t>

◆ KwSearchIds

using sh::KwSearchIds = typedef std::vector<KwSearchId>

◆ LikesCont

using sh::LikesCont = typedef std::set<FrameId>

◆ LogHash

using sh::LogHash = typedef std::string

◆ LscId

using sh::LscId = typedef std::string

◆ PageId

using sh::PageId = typedef unsigned

◆ PrimaryFrameFeatures

◆ RelevanceFeedbackQuery

◆ RelocationQuery

using sh::RelocationQuery = typedef FrameId

◆ ReqCode

using sh::ReqCode = typedef std::size_t

◆ ScreenImgsCont

using sh::ScreenImgsCont = typedef std::vector<FrameId>

◆ ScreenVideosCont

using sh::ScreenVideosCont = typedef std::set<VideoId>

◆ SecondaryFrameFeatures

◆ ShotId

using sh::ShotId = typedef unsigned

◆ ShownFramesCont

using sh::ShownFramesCont = typedef std::set<FrameId>

◆ StdMatrix

template<typename T_ = float>
using sh::StdMatrix = typedef std::vector<std::vector<T_> >

◆ StdVector

template<typename T_ = float>
using sh::StdVector = typedef std::vector<T_>

◆ SynsetId

using sh::SynsetId = typedef size_t

◆ SynsetIds

using sh::SynsetIds = typedef std::vector<SynsetId>

◆ SynsetStrings

using sh::SynsetStrings = typedef std::vector<std::string>

◆ TextualQuery

using sh::TextualQuery = typedef std::string

◆ UnixTimestamp

using sh::UnixTimestamp = typedef std::int64_t

◆ VideoFramePointer

using sh::VideoFramePointer = typedef const VideoFrame*

◆ VideoId

using sh::VideoId = typedef unsigned

◆ Weekday

using sh::Weekday = typedef uint8_t

◆ Year

using sh::Year = typedef uint16_t

Enumeration Type Documentation

◆ DisplayType

enum sh::DisplayType
strong
Enumerator
DNull 
DTopKNN 
DLoading 
DSom 
DEmbed 
DTopN 
DTopNContext 
DRand 
DVideoDetail 
DVideoReplay 
DRelocation 
NumItems 

◆ RequestType

enum sh::RequestType
strong
Enumerator
GET 
POST 

◆ SubmitResult

enum sh::SubmitResult
strong
Enumerator
CORRECT 
INCORRECT 
NOT_LOGGED_IN 

Function Documentation

◆ disp_type_to_str()

std::string sh::disp_type_to_str ( DisplayType  type)
inline

◆ ERR_VAL()

template<typename T_ >
constexpr T_ sh::ERR_VAL ( )
constexpr

Value indicating error/invalid/"NULL" value for the given type.

◆ fit_SOM()

void sh::fit_SOM ( size_t  ,
size_t  k,
size_t  dim,
size_t  niter,
const std::vector< float > &  points,
std::vector< float > &  koho,
const std::vector< float > &  nhbrdist,
const float  alphasA[2],
const float  radiiA[2],
const float  alphasB[2],
const float  radiiB[2],
const std::vector< float > &  scores,
const std::vector< bool > &  ,
std::mt19937 &  rng 
)

◆ map_points_to_kohos()

void sh::map_points_to_kohos ( size_t  start,
size_t  end,
size_t  k,
size_t  dim,
const std::vector< float > &  points,
const std::vector< float > &  koho,
std::vector< size_t > &  mapping,
const std::vector< bool > &  present_mask 
)

◆ operator""_z()

constexpr size_t sh::operator""_z ( unsigned long long int  x)
constexpr

User defined size literal.

◆ operator<<() [1/2]

std::ostream& sh::operator<< ( std::ofstream &  os,
CanvasSubqueryBitmap  x 
)
inline

◆ operator<<() [2/2]

std::ostream& sh::operator<< ( std::ofstream &  os,
CanvasSubqueryText  x 
)
inline

◆ optional_value() [1/2]

template<typename T_ >
std::optional<T_> sh::optional_value ( const json &  j,
const std::string &  key 
)
inline

Parses the (potentialy null) value from the given key in JSON structure.

◆ optional_value() [2/2]

template<>
std::optional<std::string> sh::optional_value ( const json &  j,
const std::string &  key 
)
inline

Parses the (potentialy null or empty) string from the given key in JSON structure.

Partial specialization of optional_value.

◆ optional_value_or() [1/2]

template<>
std::string sh::optional_value_or ( const json &  j,
const std::string &  key,
const std::string &  or_val 
)
inline

Parses the (potentialy null) value from the given key in JSON structure and if not defined or null uses the or_val value.

Partial specialization of optional_value_or.

◆ optional_value_or() [2/2]

template<typename T_ >
T_ sh::optional_value_or ( const json &  j,
const std::string &  key,
const T_ &  or_val 
)
inline

Parses the (potentialy null) value from the given key in JSON structure and if not defined or null uses the or_val value.

◆ require_key()

void sh::require_key ( const json &  json,
const std::string &  key 
)
inline

Makes sure that the given json has the given key and the key is not null.

Here is the call graph for this function:

◆ require_value()

void sh::require_value ( const json &  json,
const std::string &  msg = "Missing JSON value" 
)
inline

Makes sure that the given json is defined (not null and not undefined).

Parses the REQUIRED value of type T_ from the gien key in JSON.

◆ str_to_disp_type()

DisplayType sh::str_to_disp_type ( const std::string &  type_str)
inline

◆ to_std_matrix()

template<typename DType >
std::vector<std::vector<DType> > sh::to_std_matrix ( const at::Tensor &  tensor_features)

◆ to_tensor() [1/2]

template<c10::ScalarType TensorDType_ = at::kFloat, typename OrigDType_ = float>
at::Tensor sh::to_tensor ( std::vector< OrigDType_ > &  orig_vec)

◆ to_tensor() [2/2]

template<c10::ScalarType TensorDType_ = at::kFloat, typename OrigDType_ = float>
at::Tensor sh::to_tensor ( std::vector< std::vector< OrigDType_ >> &  orig_mat)

◆ wrap_and_parse()

json sh::wrap_and_parse ( std::stringstream &  in_stream)
inline

Variable Documentation

◆ MAX_TEMPORAL_SIZE

constexpr int sh::MAX_TEMPORAL_SIZE = 2
constexpr

Maximal size of temporal query.

◆ RANDOM_DISPLAY_WEIGHT

constexpr float sh::RANDOM_DISPLAY_WEIGHT = 3.0f
constexpr

◆ RELOCATION_GRID_HEIGHT

constexpr size_t sh::RELOCATION_GRID_HEIGHT = 5
constexpr

SOM relocation grid height.

◆ RELOCATION_GRID_WIDTH

constexpr size_t sh::RELOCATION_GRID_WIDTH = 5
constexpr

SOM relocation grid width.

◆ SOM_DISPLAY_GRID_HEIGHT

constexpr size_t sh::SOM_DISPLAY_GRID_HEIGHT = 8
constexpr

SOM window image grid height.

◆ SOM_DISPLAY_GRID_WIDTH

constexpr size_t sh::SOM_DISPLAY_GRID_WIDTH = 8
constexpr

SOM window image grid width.

◆ TOP_N_SELECTED_FRAME_POSITION

constexpr int sh::TOP_N_SELECTED_FRAME_POSITION = 2
constexpr