body
stringlengths
26
98.2k
body_hash
int64
-9,222,864,604,528,158,000
9,221,803,474B
docstring
stringlengths
1
16.8k
path
stringlengths
5
230
name
stringlengths
1
96
repository_name
stringlengths
7
89
lang
stringclasses
1 value
body_without_docstring
stringlengths
20
98.2k
@commands.command(name='hoogle', brief='search hoogle') async def hoogle(self, ctx, *query: str): 'Searches Hoggle and returns first two options\n Click title to see full search' url = f"https://hoogle.haskell.org?mode=json&hoogle={'+'.join(query)}&start=1&count=1" (result, error) = (await get_json(u...
-1,525,945,134,972,282,000
Searches Hoggle and returns first two options Click title to see full search
extensions/api.py
hoogle
JoseFilipeFerreira/JBB.py
python
@commands.command(name='hoogle', brief='search hoogle') async def hoogle(self, ctx, *query: str): 'Searches Hoggle and returns first two options\n Click title to see full search' url = f"https://hoogle.haskell.org?mode=json&hoogle={'+'.join(query)}&start=1&count=1" (result, error) = (await get_json(u...
def generateRequestData(self, offset, timestamp, chunkSize, isGroupConversation=False): 'Generate the data for the POST request.\n :return: the generated data\n ' ids_type = ('thread_fbids' if isGroupConversation else 'user_ids') dataForm = {'messages[{}][{}][offset]'.format(ids_type, self._c...
-2,812,959,289,043,096,600
Generate the data for the POST request. :return: the generated data
src/util/conversationScraper.py
generateRequestData
5agado/conversation-analyzer
python
def generateRequestData(self, offset, timestamp, chunkSize, isGroupConversation=False): 'Generate the data for the POST request.\n :return: the generated data\n ' ids_type = ('thread_fbids' if isGroupConversation else 'user_ids') dataForm = {'messages[{}][{}][offset]'.format(ids_type, self._c...
def executeRequest(self, requestData): 'Executes the POST request and retrieves the correspondent response content.\n Request headers are generated here\n :return: the response content\n ' headers = {'Host': 'www.facebook.com', 'Origin': 'https://www.facebook.com', 'Referer': 'https://www.f...
-2,882,766,584,559,465,500
Executes the POST request and retrieves the correspondent response content. Request headers are generated here :return: the response content
src/util/conversationScraper.py
executeRequest
5agado/conversation-analyzer
python
def executeRequest(self, requestData): 'Executes the POST request and retrieves the correspondent response content.\n Request headers are generated here\n :return: the response content\n ' headers = {'Host': 'www.facebook.com', 'Origin': 'https://www.facebook.com', 'Referer': 'https://www.f...
def scrapeConversation(self, merge, offset, timestampOffset, chunkSize, limit, isGroupConversation): 'Retrieves conversation messages and stores them in a JSON file\n If merge is specified, the new messages will be merged with the previous version of the conversation, if present\n ' if merge: ...
-4,032,054,314,809,956,000
Retrieves conversation messages and stores them in a JSON file If merge is specified, the new messages will be merged with the previous version of the conversation, if present
src/util/conversationScraper.py
scrapeConversation
5agado/conversation-analyzer
python
def scrapeConversation(self, merge, offset, timestampOffset, chunkSize, limit, isGroupConversation): 'Retrieves conversation messages and stores them in a JSON file\n If merge is specified, the new messages will be merged with the previous version of the conversation, if present\n ' if merge: ...
def check_num_list(prompt: str, max_length: int=0, min_length: int=0) -> List[float]: 'Function to check if users input is a number, splitting number\n by spaces and checking that the correct amount of numbers are\n entered, returning them in a list' while True: try: num = input(prompt...
-5,256,720,275,051,967,000
Function to check if users input is a number, splitting number by spaces and checking that the correct amount of numbers are entered, returning them in a list
150-Challenges/Challenges 27 - 34/Challenge 33.py
check_num_list
DGrifferty/Python
python
def check_num_list(prompt: str, max_length: int=0, min_length: int=0) -> List[float]: 'Function to check if users input is a number, splitting number\n by spaces and checking that the correct amount of numbers are\n entered, returning them in a list' while True: try: num = input(prompt...
def get_imdb(name): 'Get an imdb (image database) by name.' if (name not in __sets): raise KeyError('Unknown dataset: {}'.format(name)) return __sets[name]()
-3,263,413,934,054,098,000
Get an imdb (image database) by name.
lib/datasets/factory.py
get_imdb
wangvation/torch-mobilenet
python
def get_imdb(name): if (name not in __sets): raise KeyError('Unknown dataset: {}'.format(name)) return __sets[name]()
def list_imdbs(): 'List all registered imdbs.' return list(__sets.keys())
4,693,669,182,354,276,000
List all registered imdbs.
lib/datasets/factory.py
list_imdbs
wangvation/torch-mobilenet
python
def list_imdbs(): return list(__sets.keys())
def main(*args): '\n Process command line arguments and invoke bot.\n\n If args is an empty list, sys.argv is used.\n\n @param args: command line arguments\n @type args: str\n ' filename = 'fb2w.nt.gz' for arg in pywikibot.handle_args(args): if arg.startswith('-filename'): ...
8,901,002,085,312,635,000
Process command line arguments and invoke bot. If args is an empty list, sys.argv is used. @param args: command line arguments @type args: str
scripts/freebasemappingupload.py
main
5j9/pywikibot-core
python
def main(*args): '\n Process command line arguments and invoke bot.\n\n If args is an empty list, sys.argv is used.\n\n @param args: command line arguments\n @type args: str\n ' filename = 'fb2w.nt.gz' for arg in pywikibot.handle_args(args): if arg.startswith('-filename'): ...
def __init__(self, filename): 'Initializer.' self.repo = pywikibot.Site('wikidata', 'wikidata').data_repository() self.filename = filename if (not os.path.exists(self.filename)): pywikibot.output(('Cannot find %s. Try providing the absolute path.' % self.filename)) sys.exit(1)
8,991,422,563,458,918,000
Initializer.
scripts/freebasemappingupload.py
__init__
5j9/pywikibot-core
python
def __init__(self, filename): self.repo = pywikibot.Site('wikidata', 'wikidata').data_repository() self.filename = filename if (not os.path.exists(self.filename)): pywikibot.output(('Cannot find %s. Try providing the absolute path.' % self.filename)) sys.exit(1)
def run(self): 'Run the bot.' self.claim = pywikibot.Claim(self.repo, 'P646') self.statedin = pywikibot.Claim(self.repo, 'P248') freebasedumpitem = pywikibot.ItemPage(self.repo, 'Q15241312') self.statedin.setTarget(freebasedumpitem) self.dateofpub = pywikibot.Claim(self.repo, 'P577') oct28 =...
-7,101,836,632,625,595,000
Run the bot.
scripts/freebasemappingupload.py
run
5j9/pywikibot-core
python
def run(self): self.claim = pywikibot.Claim(self.repo, 'P646') self.statedin = pywikibot.Claim(self.repo, 'P248') freebasedumpitem = pywikibot.ItemPage(self.repo, 'Q15241312') self.statedin.setTarget(freebasedumpitem) self.dateofpub = pywikibot.Claim(self.repo, 'P577') oct28 = pywikibot.WbT...
def processLine(self, line): 'Process a single line.' if ((not line) or line.startswith('#')): return (mid, sameas, qid, dot) = line.split() if (sameas != '<https://www.w3.org/2002/07/owl#sameAs>'): return if (dot != '.'): return if (not mid.startswith('<https://rdf.freeb...
3,031,414,387,276,538,400
Process a single line.
scripts/freebasemappingupload.py
processLine
5j9/pywikibot-core
python
def processLine(self, line): if ((not line) or line.startswith('#')): return (mid, sameas, qid, dot) = line.split() if (sameas != '<https://www.w3.org/2002/07/owl#sameAs>'): return if (dot != '.'): return if (not mid.startswith('<https://rdf.freebase.com/ns/m')): ...
def _parse_decl_specs_simple(self, outer: str, typed: bool) -> ASTDeclSpecsSimple: 'Just parse the simple ones.' storage = None threadLocal = None inline = None virtual = None explicit = None constexpr = None volatile = None const = None friend = None attrs = [] while 1: ...
489,535,564,035,447,300
Just parse the simple ones.
sphinx/domains/cpp.py
_parse_decl_specs_simple
begolu2/sphinx
python
def _parse_decl_specs_simple(self, outer: str, typed: bool) -> ASTDeclSpecsSimple: storage = None threadLocal = None inline = None virtual = None explicit = None constexpr = None volatile = None const = None friend = None attrs = [] while 1: self.skip_ws() ...
def _parse_type(self, named: Union[(bool, str)], outer: str=None) -> ASTType: "\n named=False|'maybe'|True: 'maybe' is e.g., for function objects which\n doesn't need to name the arguments\n\n outer == operatorCast: annoying case, we should not take the params\n " if outer: i...
-6,564,301,317,631,929,000
named=False|'maybe'|True: 'maybe' is e.g., for function objects which doesn't need to name the arguments outer == operatorCast: annoying case, we should not take the params
sphinx/domains/cpp.py
_parse_type
begolu2/sphinx
python
def _parse_type(self, named: Union[(bool, str)], outer: str=None) -> ASTType: "\n named=False|'maybe'|True: 'maybe' is e.g., for function objects which\n doesn't need to name the arguments\n\n outer == operatorCast: annoying case, we should not take the params\n " if outer: i...
def run(self) -> List[Node]: "\n On purpose this doesn't call the ObjectDescription version, but is based on it.\n Each alias signature may expand into multiple real signatures (an overload set).\n The code is therefore based on the ObjectDescription version.\n " if (':' in self.name...
-4,870,467,569,921,633,000
On purpose this doesn't call the ObjectDescription version, but is based on it. Each alias signature may expand into multiple real signatures (an overload set). The code is therefore based on the ObjectDescription version.
sphinx/domains/cpp.py
run
begolu2/sphinx
python
def run(self) -> List[Node]: "\n On purpose this doesn't call the ObjectDescription version, but is based on it.\n Each alias signature may expand into multiple real signatures (an overload set).\n The code is therefore based on the ObjectDescription version.\n " if (':' in self.name...
def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions]=None, dynamic_tags_json: Optional[pulumi.Input[str]]=None, is_push_enabled: Optional[pulumi.Input[bool]]=None, kind: Optional[pulumi.Input[str]]=None, name: Optional[pulumi.Input[str]]=None, resource_group_name: Optional[pulumi.Input[str]...
-8,120,773,970,255,479,000
Push settings for the App. :param str resource_name: The name of the resource. :param pulumi.ResourceOptions opts: Options for the resource. :param pulumi.Input[str] dynamic_tags_json: Gets or sets a JSON string containing a list of dynamic tags that will be evaluated from user claims in the push registration endpoint...
sdk/python/pulumi_azure_native/web/v20200901/web_app_site_push_settings_slot.py
__init__
pulumi-bot/pulumi-azure-native
python
def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions]=None, dynamic_tags_json: Optional[pulumi.Input[str]]=None, is_push_enabled: Optional[pulumi.Input[bool]]=None, kind: Optional[pulumi.Input[str]]=None, name: Optional[pulumi.Input[str]]=None, resource_group_name: Optional[pulumi.Input[str]...
@staticmethod def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions]=None) -> 'WebAppSitePushSettingsSlot': "\n Get an existing WebAppSitePushSettingsSlot resource's state with the given name, id, and optional extra\n properties used to qualify the lookup.\n\n ...
-3,682,211,527,570,844,700
Get an existing WebAppSitePushSettingsSlot resource's state with the given name, id, and optional extra properties used to qualify the lookup. :param str resource_name: The unique name of the resulting resource. :param pulumi.Input[str] id: The unique provider ID of the resource to lookup. :param pulumi.ResourceOption...
sdk/python/pulumi_azure_native/web/v20200901/web_app_site_push_settings_slot.py
get
pulumi-bot/pulumi-azure-native
python
@staticmethod def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions]=None) -> 'WebAppSitePushSettingsSlot': "\n Get an existing WebAppSitePushSettingsSlot resource's state with the given name, id, and optional extra\n properties used to qualify the lookup.\n\n ...
@property @pulumi.getter(name='dynamicTagsJson') def dynamic_tags_json(self) -> pulumi.Output[Optional[str]]: '\n Gets or sets a JSON string containing a list of dynamic tags that will be evaluated from user claims in the push registration endpoint.\n ' return pulumi.get(self, 'dynamic_tags_json')
2,910,655,291,979,059,000
Gets or sets a JSON string containing a list of dynamic tags that will be evaluated from user claims in the push registration endpoint.
sdk/python/pulumi_azure_native/web/v20200901/web_app_site_push_settings_slot.py
dynamic_tags_json
pulumi-bot/pulumi-azure-native
python
@property @pulumi.getter(name='dynamicTagsJson') def dynamic_tags_json(self) -> pulumi.Output[Optional[str]]: '\n \n ' return pulumi.get(self, 'dynamic_tags_json')
@property @pulumi.getter(name='isPushEnabled') def is_push_enabled(self) -> pulumi.Output[bool]: '\n Gets or sets a flag indicating whether the Push endpoint is enabled.\n ' return pulumi.get(self, 'is_push_enabled')
4,037,824,550,830,096,400
Gets or sets a flag indicating whether the Push endpoint is enabled.
sdk/python/pulumi_azure_native/web/v20200901/web_app_site_push_settings_slot.py
is_push_enabled
pulumi-bot/pulumi-azure-native
python
@property @pulumi.getter(name='isPushEnabled') def is_push_enabled(self) -> pulumi.Output[bool]: '\n \n ' return pulumi.get(self, 'is_push_enabled')
@property @pulumi.getter def kind(self) -> pulumi.Output[Optional[str]]: '\n Kind of resource.\n ' return pulumi.get(self, 'kind')
-1,425,049,396,835,993,600
Kind of resource.
sdk/python/pulumi_azure_native/web/v20200901/web_app_site_push_settings_slot.py
kind
pulumi-bot/pulumi-azure-native
python
@property @pulumi.getter def kind(self) -> pulumi.Output[Optional[str]]: '\n \n ' return pulumi.get(self, 'kind')
@property @pulumi.getter def name(self) -> pulumi.Output[str]: '\n Resource Name.\n ' return pulumi.get(self, 'name')
1,193,115,514,403,237,400
Resource Name.
sdk/python/pulumi_azure_native/web/v20200901/web_app_site_push_settings_slot.py
name
pulumi-bot/pulumi-azure-native
python
@property @pulumi.getter def name(self) -> pulumi.Output[str]: '\n \n ' return pulumi.get(self, 'name')
@property @pulumi.getter(name='systemData') def system_data(self) -> pulumi.Output['outputs.SystemDataResponse']: '\n The system metadata relating to this resource.\n ' return pulumi.get(self, 'system_data')
-7,169,214,494,930,004,000
The system metadata relating to this resource.
sdk/python/pulumi_azure_native/web/v20200901/web_app_site_push_settings_slot.py
system_data
pulumi-bot/pulumi-azure-native
python
@property @pulumi.getter(name='systemData') def system_data(self) -> pulumi.Output['outputs.SystemDataResponse']: '\n \n ' return pulumi.get(self, 'system_data')
@property @pulumi.getter(name='tagWhitelistJson') def tag_whitelist_json(self) -> pulumi.Output[Optional[str]]: '\n Gets or sets a JSON string containing a list of tags that are whitelisted for use by the push registration endpoint.\n ' return pulumi.get(self, 'tag_whitelist_json')
-212,308,369,731,080,420
Gets or sets a JSON string containing a list of tags that are whitelisted for use by the push registration endpoint.
sdk/python/pulumi_azure_native/web/v20200901/web_app_site_push_settings_slot.py
tag_whitelist_json
pulumi-bot/pulumi-azure-native
python
@property @pulumi.getter(name='tagWhitelistJson') def tag_whitelist_json(self) -> pulumi.Output[Optional[str]]: '\n \n ' return pulumi.get(self, 'tag_whitelist_json')
@property @pulumi.getter(name='tagsRequiringAuth') def tags_requiring_auth(self) -> pulumi.Output[Optional[str]]: "\n Gets or sets a JSON string containing a list of tags that require user authentication to be used in the push registration endpoint.\n Tags can consist of alphanumeric characters and th...
-2,422,842,160,071,476,000
Gets or sets a JSON string containing a list of tags that require user authentication to be used in the push registration endpoint. Tags can consist of alphanumeric characters and the following: '_', '@', '#', '.', ':', '-'. Validation should be performed at the PushRequestHandler.
sdk/python/pulumi_azure_native/web/v20200901/web_app_site_push_settings_slot.py
tags_requiring_auth
pulumi-bot/pulumi-azure-native
python
@property @pulumi.getter(name='tagsRequiringAuth') def tags_requiring_auth(self) -> pulumi.Output[Optional[str]]: "\n Gets or sets a JSON string containing a list of tags that require user authentication to be used in the push registration endpoint.\n Tags can consist of alphanumeric characters and th...
@property @pulumi.getter def type(self) -> pulumi.Output[str]: '\n Resource type.\n ' return pulumi.get(self, 'type')
2,132,950,812,122,862,800
Resource type.
sdk/python/pulumi_azure_native/web/v20200901/web_app_site_push_settings_slot.py
type
pulumi-bot/pulumi-azure-native
python
@property @pulumi.getter def type(self) -> pulumi.Output[str]: '\n \n ' return pulumi.get(self, 'type')
def _define_structure(self): '\n Define the main sizers building to build this application.\n ' self.main_sizer = wx.BoxSizer(wx.VERTICAL) self.box_source = wx.StaticBox(self, (- 1), str('Kiessig Thickness Calculator')) self.boxsizer_source = wx.StaticBoxSizer(self.box_source, wx.VERTICAL)...
4,143,718,605,268,381,000
Define the main sizers building to build this application.
src/sas/sasgui/perspectives/calculator/kiessig_calculator_panel.py
_define_structure
andyfaff/sasview
python
def _define_structure(self): '\n \n ' self.main_sizer = wx.BoxSizer(wx.VERTICAL) self.box_source = wx.StaticBox(self, (- 1), str('Kiessig Thickness Calculator')) self.boxsizer_source = wx.StaticBoxSizer(self.box_source, wx.VERTICAL) self.dq_name_sizer = wx.BoxSizer(wx.HORIZONTAL) s...
def _layout_dq_name(self): '\n Fill the sizer containing dq name\n ' dq_value = str(self.kiessig.get_deltaq()) dq_unit_txt = wx.StaticText(self, (- 1), '[1/A]') dq_name_txt = wx.StaticText(self, (- 1), 'Kiessig Fringe Width (Delta Q): ') self.dq_name_tcl = InputTextCtrl(self, (- 1), si...
1,429,371,075,089,788,000
Fill the sizer containing dq name
src/sas/sasgui/perspectives/calculator/kiessig_calculator_panel.py
_layout_dq_name
andyfaff/sasview
python
def _layout_dq_name(self): '\n \n ' dq_value = str(self.kiessig.get_deltaq()) dq_unit_txt = wx.StaticText(self, (- 1), '[1/A]') dq_name_txt = wx.StaticText(self, (- 1), 'Kiessig Fringe Width (Delta Q): ') self.dq_name_tcl = InputTextCtrl(self, (- 1), size=(_BOX_WIDTH, (- 1))) dq_hi...
def _layout_thickness_size(self): '\n Fill the sizer containing thickness information\n ' thick_unit = (('[' + self.kiessig.get_thickness_unit()) + ']') thickness_size_txt = wx.StaticText(self, (- 1), 'Thickness (or Diameter): ') self.thickness_size_tcl = OutputTextCtrl(self, (- 1), size=(...
3,358,032,383,524,434,400
Fill the sizer containing thickness information
src/sas/sasgui/perspectives/calculator/kiessig_calculator_panel.py
_layout_thickness_size
andyfaff/sasview
python
def _layout_thickness_size(self): '\n \n ' thick_unit = (('[' + self.kiessig.get_thickness_unit()) + ']') thickness_size_txt = wx.StaticText(self, (- 1), 'Thickness (or Diameter): ') self.thickness_size_tcl = OutputTextCtrl(self, (- 1), size=(_BOX_WIDTH, (- 1))) thickness_size_hint = '...
def _layout_hint(self): '\n Fill the sizer containing hint \n ' hint_msg = 'This tool is to approximately estimate ' hint_msg += 'the thickness of a layer' hint_msg += ' or the diameter of particles\n ' hint_msg += 'from the Kiessig fringe width in SAS/NR data.' hint_msg += '' ...
-8,116,110,328,013,586,000
Fill the sizer containing hint
src/sas/sasgui/perspectives/calculator/kiessig_calculator_panel.py
_layout_hint
andyfaff/sasview
python
def _layout_hint(self): '\n \n ' hint_msg = 'This tool is to approximately estimate ' hint_msg += 'the thickness of a layer' hint_msg += ' or the diameter of particles\n ' hint_msg += 'from the Kiessig fringe width in SAS/NR data.' hint_msg += self.hint_txt = wx.StaticText(se...
def _layout_button(self): '\n Do the layout for the button widgets\n ' id = wx.NewId() self.bt_help = wx.Button(self, id, 'HELP') self.bt_help.Bind(wx.EVT_BUTTON, self.on_help) self.bt_help.SetToolTipString('Help using the Kiessig fringe calculator.') self.bt_close = wx.Button(self...
-6,821,566,193,316,706,000
Do the layout for the button widgets
src/sas/sasgui/perspectives/calculator/kiessig_calculator_panel.py
_layout_button
andyfaff/sasview
python
def _layout_button(self): '\n \n ' id = wx.NewId() self.bt_help = wx.Button(self, id, 'HELP') self.bt_help.Bind(wx.EVT_BUTTON, self.on_help) self.bt_help.SetToolTipString('Help using the Kiessig fringe calculator.') self.bt_close = wx.Button(self, wx.ID_CANCEL, 'Close') self.bt...
def _do_layout(self): '\n Draw window content\n ' self._define_structure() self._layout_dq_name() self._layout_thickness_size() self._layout_hint() self._layout_button() self.boxsizer_source.AddMany([(self.dq_name_sizer, 0, ((wx.EXPAND | wx.TOP) | wx.BOTTOM), 5), (self.thic...
-3,224,533,211,146,210,300
Draw window content
src/sas/sasgui/perspectives/calculator/kiessig_calculator_panel.py
_do_layout
andyfaff/sasview
python
def _do_layout(self): '\n \n ' self._define_structure() self._layout_dq_name() self._layout_thickness_size() self._layout_hint() self._layout_button() self.boxsizer_source.AddMany([(self.dq_name_sizer, 0, ((wx.EXPAND | wx.TOP) | wx.BOTTOM), 5), (self.thickness_size_sizer, 0...
def on_help(self, event): '\n Bring up the Kiessig fringe calculator Documentation whenever\n the HELP button is clicked.\n Calls DocumentationWindow with the path of the location within the\n documentation tree (after /doc/ ....". Note that when using old\n versions of Wx (befor...
6,930,186,287,438,744,000
Bring up the Kiessig fringe calculator Documentation whenever the HELP button is clicked. Calls DocumentationWindow with the path of the location within the documentation tree (after /doc/ ....". Note that when using old versions of Wx (before 2.9) and thus not the release version of installers, th...
src/sas/sasgui/perspectives/calculator/kiessig_calculator_panel.py
on_help
andyfaff/sasview
python
def on_help(self, event): '\n Bring up the Kiessig fringe calculator Documentation whenever\n the HELP button is clicked.\n Calls DocumentationWindow with the path of the location within the\n documentation tree (after /doc/ ....". Note that when using old\n versions of Wx (befor...
def on_close(self, event): '\n close the window containing this panel\n ' self.parent.Close() if (event is not None): event.Skip()
-8,261,816,066,434,704,000
close the window containing this panel
src/sas/sasgui/perspectives/calculator/kiessig_calculator_panel.py
on_close
andyfaff/sasview
python
def on_close(self, event): '\n \n ' self.parent.Close() if (event is not None): event.Skip()
def on_compute(self, event): '\n Execute the computation of thickness\n ' if (event is not None): event.Skip() dq = self.dq_name_tcl.GetValue() self.kiessig.set_deltaq(dq) output = self.kiessig.compute_thickness() thickness = self.format_number(output) self.thickness_si...
4,238,333,682,032,974,300
Execute the computation of thickness
src/sas/sasgui/perspectives/calculator/kiessig_calculator_panel.py
on_compute
andyfaff/sasview
python
def on_compute(self, event): '\n \n ' if (event is not None): event.Skip() dq = self.dq_name_tcl.GetValue() self.kiessig.set_deltaq(dq) output = self.kiessig.compute_thickness() thickness = self.format_number(output) self.thickness_size_tcl.SetValue(str(thickness))
def format_number(self, value=None): '\n Return a float in a standardized, human-readable formatted string\n ' try: value = float(value) except: output = None return output output = ('%-7.4g' % value) return output.lstrip().rstrip()
3,595,117,808,034,005,000
Return a float in a standardized, human-readable formatted string
src/sas/sasgui/perspectives/calculator/kiessig_calculator_panel.py
format_number
andyfaff/sasview
python
def format_number(self, value=None): '\n \n ' try: value = float(value) except: output = None return output output = ('%-7.4g' % value) return output.lstrip().rstrip()
def _onparamEnter(self, event=None): '\n On Text_enter_callback, perform compute\n ' self.on_compute(event)
-6,448,870,365,049,814,000
On Text_enter_callback, perform compute
src/sas/sasgui/perspectives/calculator/kiessig_calculator_panel.py
_onparamEnter
andyfaff/sasview
python
def _onparamEnter(self, event=None): '\n \n ' self.on_compute(event)
def on_close(self, event): '\n Close event\n ' if (self.manager is not None): self.manager.kiessig_frame = None self.Destroy()
-8,310,142,565,720,282,000
Close event
src/sas/sasgui/perspectives/calculator/kiessig_calculator_panel.py
on_close
andyfaff/sasview
python
def on_close(self, event): '\n \n ' if (self.manager is not None): self.manager.kiessig_frame = None self.Destroy()
@classmethod def find_project_root_directory(cls, current_directory: Optional[Path]) -> Optional[Path]: "\n Given a directory (with ``None`` implying the current directory) assumed to be at or under this project's root,\n find the project root directory.\n This implementation attempts to find a...
-2,530,477,784,102,690,000
Given a directory (with ``None`` implying the current directory) assumed to be at or under this project's root, find the project root directory. This implementation attempts to find a directory having both a ``.git/`` child directory and a ``.env`` file. Parameters ---------- current_directory Returns ------- Optional[...
github_archive/test/test_get_github.py
find_project_root_directory
hellkite500/github_archive
python
@classmethod def find_project_root_directory(cls, current_directory: Optional[Path]) -> Optional[Path]: "\n Given a directory (with ``None`` implying the current directory) assumed to be at or under this project's root,\n find the project root directory.\n This implementation attempts to find a...
@classmethod def load_token(cls): "\n Read an API token from a configuration file, if none found, use '' for no auth\n " token = '' root_dir = cls.find_project_root_directory(None) if (not root_dir): return token config_file = (root_dir / 'config.yaml') if config_file.e...
7,484,951,432,618,107,000
Read an API token from a configuration file, if none found, use '' for no auth
github_archive/test/test_get_github.py
load_token
hellkite500/github_archive
python
@classmethod def load_token(cls): "\n \n " token = root_dir = cls.find_project_root_directory(None) if (not root_dir): return token config_file = (root_dir / 'config.yaml') if config_file.exists(): with open(config_file) as file: config = yaml.load(...
def test_get_repo_meta(self): '\n Test the archive_repo function to ensure all meta data is properly captured\n ' meta = get_repo_meta(self.repo, self.time, TestGetGithub._current_dir) self.assertIsNotNone(meta) self.assertTrue(len(meta), 6) pattern = '{repo}_{name}_{time}.json'.fo...
8,121,341,174,717,497,000
Test the archive_repo function to ensure all meta data is properly captured
github_archive/test/test_get_github.py
test_get_repo_meta
hellkite500/github_archive
python
def test_get_repo_meta(self): '\n \n ' meta = get_repo_meta(self.repo, self.time, TestGetGithub._current_dir) self.assertIsNotNone(meta) self.assertTrue(len(meta), 6) pattern = '{repo}_{name}_{time}.json'.format(repo=self.repo_string, name='{name}', time=self.time) self.assertE...
def test_clone_and_archive(self): '\n Test the clone functionality\n ' self.assertFalse(self.repo.has_wiki) clone_url = self.repo.clone_url archive_name = clone_and_archive(self.repo_string, clone_url, self.time, TestGetGithub._current_dir, []) name = '{repo}_github_archive_{time}....
-257,225,097,966,887,840
Test the clone functionality
github_archive/test/test_get_github.py
test_clone_and_archive
hellkite500/github_archive
python
def test_clone_and_archive(self): '\n \n ' self.assertFalse(self.repo.has_wiki) clone_url = self.repo.clone_url archive_name = clone_and_archive(self.repo_string, clone_url, self.time, TestGetGithub._current_dir, []) name = '{repo}_github_archive_{time}.tar.gz'.format(repo=self.rep...
def test_clone_and_archive_1(self): '\n Test cloning a repo with a wiki\n ' self.assertTrue(self.wiki_repo.has_wiki) wiki_url = (self.wiki_repo.clone_url[:(- 3)] + 'wiki.git') clone_url = self.wiki_repo.clone_url archive_name = clone_and_archive(self.repo_w_wiki, clone_url, self.ti...
-7,822,465,264,797,826,000
Test cloning a repo with a wiki
github_archive/test/test_get_github.py
test_clone_and_archive_1
hellkite500/github_archive
python
def test_clone_and_archive_1(self): '\n \n ' self.assertTrue(self.wiki_repo.has_wiki) wiki_url = (self.wiki_repo.clone_url[:(- 3)] + 'wiki.git') clone_url = self.wiki_repo.clone_url archive_name = clone_and_archive(self.repo_w_wiki, clone_url, self.time, TestGetGithub._current_dir,...
def policy_v0(): 'Autoaugment policy that was used in AutoAugment Detection Paper.' policy = [[('TranslateX_BBox', 0.6, 4), ('Equalize', 0.8, 10)], [('TranslateY_Only_BBoxes', 0.2, 2), ('Cutout', 0.8, 8)], [('Sharpness', 0.0, 8), ('ShearX_BBox', 0.4, 0)], [('ShearY_BBox', 1.0, 2), ('TranslateY_Only_BBoxes', 0.6...
8,460,943,867,710,150,000
Autoaugment policy that was used in AutoAugment Detection Paper.
efficientdet/aug/autoaugment.py
policy_v0
datawowio/automl
python
def policy_v0(): policy = [[('TranslateX_BBox', 0.6, 4), ('Equalize', 0.8, 10)], [('TranslateY_Only_BBoxes', 0.2, 2), ('Cutout', 0.8, 8)], [('Sharpness', 0.0, 8), ('ShearX_BBox', 0.4, 0)], [('ShearY_BBox', 1.0, 2), ('TranslateY_Only_BBoxes', 0.6, 6)], [('Rotate_BBox', 0.6, 10), ('Color', 1.0, 6)]] return p...
def policy_v1(): 'Autoaugment policy that was used in AutoAugment Detection Paper.' policy = [[('TranslateX_BBox', 0.6, 4), ('Equalize', 0.8, 10)], [('TranslateY_Only_BBoxes', 0.2, 2), ('Cutout', 0.8, 8)], [('Sharpness', 0.0, 8), ('ShearX_BBox', 0.4, 0)], [('ShearY_BBox', 1.0, 2), ('TranslateY_Only_BBoxes', 0.6...
-8,715,538,783,788,513,000
Autoaugment policy that was used in AutoAugment Detection Paper.
efficientdet/aug/autoaugment.py
policy_v1
datawowio/automl
python
def policy_v1(): policy = [[('TranslateX_BBox', 0.6, 4), ('Equalize', 0.8, 10)], [('TranslateY_Only_BBoxes', 0.2, 2), ('Cutout', 0.8, 8)], [('Sharpness', 0.0, 8), ('ShearX_BBox', 0.4, 0)], [('ShearY_BBox', 1.0, 2), ('TranslateY_Only_BBoxes', 0.6, 6)], [('Rotate_BBox', 0.6, 10), ('Color', 1.0, 6)], [('Color', 0...
def policy_vtest(): 'Autoaugment test policy for debugging.' policy = [[('TranslateX_BBox', 1.0, 4), ('Equalize', 1.0, 10)]] return policy
-9,018,532,416,153,881,000
Autoaugment test policy for debugging.
efficientdet/aug/autoaugment.py
policy_vtest
datawowio/automl
python
def policy_vtest(): policy = [[('TranslateX_BBox', 1.0, 4), ('Equalize', 1.0, 10)]] return policy
def policy_v2(): 'Additional policy that performs well on object detection.' policy = [[('Color', 0.0, 6), ('Cutout', 0.6, 8), ('Sharpness', 0.4, 8)], [('Rotate_BBox', 0.4, 8), ('Sharpness', 0.4, 2), ('Rotate_BBox', 0.8, 10)], [('TranslateY_BBox', 1.0, 8), ('AutoContrast', 0.8, 2)], [('AutoContrast', 0.4, 6), (...
8,499,406,954,455,301,000
Additional policy that performs well on object detection.
efficientdet/aug/autoaugment.py
policy_v2
datawowio/automl
python
def policy_v2(): policy = [[('Color', 0.0, 6), ('Cutout', 0.6, 8), ('Sharpness', 0.4, 8)], [('Rotate_BBox', 0.4, 8), ('Sharpness', 0.4, 2), ('Rotate_BBox', 0.8, 10)], [('TranslateY_BBox', 1.0, 8), ('AutoContrast', 0.8, 2)], [('AutoContrast', 0.4, 6), ('ShearX_BBox', 0.8, 8), ('Brightness', 0.0, 10)], [('Solari...
def policy_v3(): '"Additional policy that performs well on object detection.' policy = [[('Posterize', 0.8, 2), ('TranslateX_BBox', 1.0, 8)], [('BBox_Cutout', 0.2, 10), ('Sharpness', 1.0, 8)], [('Rotate_BBox', 0.6, 8), ('Rotate_BBox', 0.8, 10)], [('Equalize', 0.8, 10), ('AutoContrast', 0.2, 10)], [('SolarizeAdd...
-2,631,217,006,608,270,000
"Additional policy that performs well on object detection.
efficientdet/aug/autoaugment.py
policy_v3
datawowio/automl
python
def policy_v3(): policy = [[('Posterize', 0.8, 2), ('TranslateX_BBox', 1.0, 8)], [('BBox_Cutout', 0.2, 10), ('Sharpness', 1.0, 8)], [('Rotate_BBox', 0.6, 8), ('Rotate_BBox', 0.8, 10)], [('Equalize', 0.8, 10), ('AutoContrast', 0.2, 10)], [('SolarizeAdd', 0.2, 2), ('TranslateY_BBox', 0.2, 8)], [('Sharpness', 0.0...
def blend(image1, image2, factor): 'Blend image1 and image2 using \'factor\'.\n\n Factor can be above 0.0. A value of 0.0 means only image1 is used.\n A value of 1.0 means only image2 is used. A value between 0.0 and\n 1.0 means we linearly interpolate the pixel values between the two\n images. A value great...
-7,071,893,540,884,844,000
Blend image1 and image2 using 'factor'. Factor can be above 0.0. A value of 0.0 means only image1 is used. A value of 1.0 means only image2 is used. A value between 0.0 and 1.0 means we linearly interpolate the pixel values between the two images. A value greater than 1.0 "extrapolates" the difference between the t...
efficientdet/aug/autoaugment.py
blend
datawowio/automl
python
def blend(image1, image2, factor): 'Blend image1 and image2 using \'factor\'.\n\n Factor can be above 0.0. A value of 0.0 means only image1 is used.\n A value of 1.0 means only image2 is used. A value between 0.0 and\n 1.0 means we linearly interpolate the pixel values between the two\n images. A value great...
def cutout(image, pad_size, replace=0): 'Apply cutout (https://arxiv.org/abs/1708.04552) to image.\n\n This operation applies a (2*pad_size x 2*pad_size) mask of zeros to\n a random location within `img`. The pixel values filled in will be of the\n value `replace`. The located where the mask will be applied is r...
-4,239,343,247,505,422,000
Apply cutout (https://arxiv.org/abs/1708.04552) to image. This operation applies a (2*pad_size x 2*pad_size) mask of zeros to a random location within `img`. The pixel values filled in will be of the value `replace`. The located where the mask will be applied is randomly chosen uniformly over the whole image. Args: ...
efficientdet/aug/autoaugment.py
cutout
datawowio/automl
python
def cutout(image, pad_size, replace=0): 'Apply cutout (https://arxiv.org/abs/1708.04552) to image.\n\n This operation applies a (2*pad_size x 2*pad_size) mask of zeros to\n a random location within `img`. The pixel values filled in will be of the\n value `replace`. The located where the mask will be applied is r...
def color(image, factor): 'Equivalent of PIL Color.' degenerate = tf.image.grayscale_to_rgb(tf.image.rgb_to_grayscale(image)) return blend(degenerate, image, factor)
2,872,861,326,192,433,000
Equivalent of PIL Color.
efficientdet/aug/autoaugment.py
color
datawowio/automl
python
def color(image, factor): degenerate = tf.image.grayscale_to_rgb(tf.image.rgb_to_grayscale(image)) return blend(degenerate, image, factor)
def contrast(image, factor): 'Equivalent of PIL Contrast.' degenerate = tf.image.rgb_to_grayscale(image) degenerate = tf.cast(degenerate, tf.int32) mean = tf.reduce_mean(tf.cast(degenerate, tf.float32)) degenerate = (tf.ones_like(degenerate, dtype=tf.float32) * mean) degenerate = tf.clip_by_valu...
3,150,907,722,058,286,000
Equivalent of PIL Contrast.
efficientdet/aug/autoaugment.py
contrast
datawowio/automl
python
def contrast(image, factor): degenerate = tf.image.rgb_to_grayscale(image) degenerate = tf.cast(degenerate, tf.int32) mean = tf.reduce_mean(tf.cast(degenerate, tf.float32)) degenerate = (tf.ones_like(degenerate, dtype=tf.float32) * mean) degenerate = tf.clip_by_value(degenerate, 0.0, 255.0) ...
def brightness(image, factor): 'Equivalent of PIL Brightness.' degenerate = tf.zeros_like(image) return blend(degenerate, image, factor)
-5,514,793,971,791,669,000
Equivalent of PIL Brightness.
efficientdet/aug/autoaugment.py
brightness
datawowio/automl
python
def brightness(image, factor): degenerate = tf.zeros_like(image) return blend(degenerate, image, factor)
def posterize(image, bits): 'Equivalent of PIL Posterize.' shift = (8 - bits) return tf.bitwise.left_shift(tf.bitwise.right_shift(image, shift), shift)
-7,653,707,230,299,955,000
Equivalent of PIL Posterize.
efficientdet/aug/autoaugment.py
posterize
datawowio/automl
python
def posterize(image, bits): shift = (8 - bits) return tf.bitwise.left_shift(tf.bitwise.right_shift(image, shift), shift)
def rotate(image, degrees, replace): 'Rotates the image by degrees either clockwise or counterclockwise.\n\n Args:\n image: An image Tensor of type uint8.\n degrees: Float, a scalar angle in degrees to rotate all images by. If\n degrees is positive the image will be rotated clockwise otherwise it will\n...
9,033,878,547,422,465,000
Rotates the image by degrees either clockwise or counterclockwise. Args: image: An image Tensor of type uint8. degrees: Float, a scalar angle in degrees to rotate all images by. If degrees is positive the image will be rotated clockwise otherwise it will be rotated counterclockwise. replace: A one or thr...
efficientdet/aug/autoaugment.py
rotate
datawowio/automl
python
def rotate(image, degrees, replace): 'Rotates the image by degrees either clockwise or counterclockwise.\n\n Args:\n image: An image Tensor of type uint8.\n degrees: Float, a scalar angle in degrees to rotate all images by. If\n degrees is positive the image will be rotated clockwise otherwise it will\n...
def random_shift_bbox(image, bbox, pixel_scaling, replace, new_min_bbox_coords=None): 'Move the bbox and the image content to a slightly new random location.\n\n Args:\n image: 3D uint8 Tensor.\n bbox: 1D Tensor that has 4 elements (min_y, min_x, max_y, max_x)\n of type float that represents the normali...
-5,648,054,145,612,244,000
Move the bbox and the image content to a slightly new random location. Args: image: 3D uint8 Tensor. bbox: 1D Tensor that has 4 elements (min_y, min_x, max_y, max_x) of type float that represents the normalized coordinates between 0 and 1. The potential values for the new min corner of the bbox will be bet...
efficientdet/aug/autoaugment.py
random_shift_bbox
datawowio/automl
python
def random_shift_bbox(image, bbox, pixel_scaling, replace, new_min_bbox_coords=None): 'Move the bbox and the image content to a slightly new random location.\n\n Args:\n image: 3D uint8 Tensor.\n bbox: 1D Tensor that has 4 elements (min_y, min_x, max_y, max_x)\n of type float that represents the normali...
def _clip_bbox(min_y, min_x, max_y, max_x): 'Clip bounding box coordinates between 0 and 1.\n\n Args:\n min_y: Normalized bbox coordinate of type float between 0 and 1.\n min_x: Normalized bbox coordinate of type float between 0 and 1.\n max_y: Normalized bbox coordinate of type float between 0 and 1.\n ...
-5,820,401,531,858,483,000
Clip bounding box coordinates between 0 and 1. Args: min_y: Normalized bbox coordinate of type float between 0 and 1. min_x: Normalized bbox coordinate of type float between 0 and 1. max_y: Normalized bbox coordinate of type float between 0 and 1. max_x: Normalized bbox coordinate of type float between 0 and 1...
efficientdet/aug/autoaugment.py
_clip_bbox
datawowio/automl
python
def _clip_bbox(min_y, min_x, max_y, max_x): 'Clip bounding box coordinates between 0 and 1.\n\n Args:\n min_y: Normalized bbox coordinate of type float between 0 and 1.\n min_x: Normalized bbox coordinate of type float between 0 and 1.\n max_y: Normalized bbox coordinate of type float between 0 and 1.\n ...
def _check_bbox_area(min_y, min_x, max_y, max_x, delta=0.05): 'Adjusts bbox coordinates to make sure the area is > 0.\n\n Args:\n min_y: Normalized bbox coordinate of type float between 0 and 1.\n min_x: Normalized bbox coordinate of type float between 0 and 1.\n max_y: Normalized bbox coordinate of type ...
68,563,721,215,404,140
Adjusts bbox coordinates to make sure the area is > 0. Args: min_y: Normalized bbox coordinate of type float between 0 and 1. min_x: Normalized bbox coordinate of type float between 0 and 1. max_y: Normalized bbox coordinate of type float between 0 and 1. max_x: Normalized bbox coordinate of type float between...
efficientdet/aug/autoaugment.py
_check_bbox_area
datawowio/automl
python
def _check_bbox_area(min_y, min_x, max_y, max_x, delta=0.05): 'Adjusts bbox coordinates to make sure the area is > 0.\n\n Args:\n min_y: Normalized bbox coordinate of type float between 0 and 1.\n min_x: Normalized bbox coordinate of type float between 0 and 1.\n max_y: Normalized bbox coordinate of type ...
def _scale_bbox_only_op_probability(prob): 'Reduce the probability of the bbox-only operation.\n\n Probability is reduced so that we do not distort the content of too many\n bounding boxes that are close to each other. The value of 3.0 was a chosen\n hyper parameter when designing the autoaugment algorithm that ...
8,180,426,613,846,989,000
Reduce the probability of the bbox-only operation. Probability is reduced so that we do not distort the content of too many bounding boxes that are close to each other. The value of 3.0 was a chosen hyper parameter when designing the autoaugment algorithm that we found empirically to work well. Args: prob: Float th...
efficientdet/aug/autoaugment.py
_scale_bbox_only_op_probability
datawowio/automl
python
def _scale_bbox_only_op_probability(prob): 'Reduce the probability of the bbox-only operation.\n\n Probability is reduced so that we do not distort the content of too many\n bounding boxes that are close to each other. The value of 3.0 was a chosen\n hyper parameter when designing the autoaugment algorithm that ...
def _apply_bbox_augmentation(image, bbox, augmentation_func, *args): 'Applies augmentation_func to the subsection of image indicated by bbox.\n\n Args:\n image: 3D uint8 Tensor.\n bbox: 1D Tensor that has 4 elements (min_y, min_x, max_y, max_x)\n of type float that represents the normalized coordinates ...
5,033,668,537,318,786,000
Applies augmentation_func to the subsection of image indicated by bbox. Args: image: 3D uint8 Tensor. bbox: 1D Tensor that has 4 elements (min_y, min_x, max_y, max_x) of type float that represents the normalized coordinates between 0 and 1. augmentation_func: Augmentation function that will be applied to the...
efficientdet/aug/autoaugment.py
_apply_bbox_augmentation
datawowio/automl
python
def _apply_bbox_augmentation(image, bbox, augmentation_func, *args): 'Applies augmentation_func to the subsection of image indicated by bbox.\n\n Args:\n image: 3D uint8 Tensor.\n bbox: 1D Tensor that has 4 elements (min_y, min_x, max_y, max_x)\n of type float that represents the normalized coordinates ...
def _concat_bbox(bbox, bboxes): 'Helper function that concats bbox to bboxes along the first dimension.' bboxes_sum_check = tf.reduce_sum(bboxes) bbox = tf.expand_dims(bbox, 0) bboxes = tf.cond(tf.equal(bboxes_sum_check, (- 4.0)), (lambda : bbox), (lambda : tf.concat([bboxes, bbox], 0))) return bbox...
9,145,103,630,591,172,000
Helper function that concats bbox to bboxes along the first dimension.
efficientdet/aug/autoaugment.py
_concat_bbox
datawowio/automl
python
def _concat_bbox(bbox, bboxes): bboxes_sum_check = tf.reduce_sum(bboxes) bbox = tf.expand_dims(bbox, 0) bboxes = tf.cond(tf.equal(bboxes_sum_check, (- 4.0)), (lambda : bbox), (lambda : tf.concat([bboxes, bbox], 0))) return bboxes
def _apply_bbox_augmentation_wrapper(image, bbox, new_bboxes, prob, augmentation_func, func_changes_bbox, *args): 'Applies _apply_bbox_augmentation with probability prob.\n\n Args:\n image: 3D uint8 Tensor.\n bbox: 1D Tensor that has 4 elements (min_y, min_x, max_y, max_x)\n of type float that represent...
-6,801,094,433,672,039,000
Applies _apply_bbox_augmentation with probability prob. Args: image: 3D uint8 Tensor. bbox: 1D Tensor that has 4 elements (min_y, min_x, max_y, max_x) of type float that represents the normalized coordinates between 0 and 1. new_bboxes: 2D Tensor that is a list of the bboxes in the image after they have ...
efficientdet/aug/autoaugment.py
_apply_bbox_augmentation_wrapper
datawowio/automl
python
def _apply_bbox_augmentation_wrapper(image, bbox, new_bboxes, prob, augmentation_func, func_changes_bbox, *args): 'Applies _apply_bbox_augmentation with probability prob.\n\n Args:\n image: 3D uint8 Tensor.\n bbox: 1D Tensor that has 4 elements (min_y, min_x, max_y, max_x)\n of type float that represent...
def _apply_multi_bbox_augmentation(image, bboxes, prob, aug_func, func_changes_bbox, *args): 'Applies aug_func to the image for each bbox in bboxes.\n\n Args:\n image: 3D uint8 Tensor.\n bboxes: 2D Tensor that is a list of the bboxes in the image. Each bbox\n has 4 elements (min_y, min_x, max_y, max_x) ...
102,916,792,991,740,450
Applies aug_func to the image for each bbox in bboxes. Args: image: 3D uint8 Tensor. bboxes: 2D Tensor that is a list of the bboxes in the image. Each bbox has 4 elements (min_y, min_x, max_y, max_x) of type float. prob: Float that is the probability of applying aug_func to a specific bounding box within...
efficientdet/aug/autoaugment.py
_apply_multi_bbox_augmentation
datawowio/automl
python
def _apply_multi_bbox_augmentation(image, bboxes, prob, aug_func, func_changes_bbox, *args): 'Applies aug_func to the image for each bbox in bboxes.\n\n Args:\n image: 3D uint8 Tensor.\n bboxes: 2D Tensor that is a list of the bboxes in the image. Each bbox\n has 4 elements (min_y, min_x, max_y, max_x) ...
def _apply_multi_bbox_augmentation_wrapper(image, bboxes, prob, aug_func, func_changes_bbox, *args): 'Checks to be sure num bboxes > 0 before calling inner function.' num_bboxes = tf.shape(bboxes)[0] (image, bboxes) = tf.cond(tf.equal(num_bboxes, 0), (lambda : (image, bboxes)), (lambda : _apply_multi_bbox_a...
-2,794,229,445,988,702,000
Checks to be sure num bboxes > 0 before calling inner function.
efficientdet/aug/autoaugment.py
_apply_multi_bbox_augmentation_wrapper
datawowio/automl
python
def _apply_multi_bbox_augmentation_wrapper(image, bboxes, prob, aug_func, func_changes_bbox, *args): num_bboxes = tf.shape(bboxes)[0] (image, bboxes) = tf.cond(tf.equal(num_bboxes, 0), (lambda : (image, bboxes)), (lambda : _apply_multi_bbox_augmentation(image, bboxes, prob, aug_func, func_changes_bbox, *ar...
def rotate_only_bboxes(image, bboxes, prob, degrees, replace): 'Apply rotate to each bbox in the image with probability prob.' func_changes_bbox = False prob = _scale_bbox_only_op_probability(prob) return _apply_multi_bbox_augmentation_wrapper(image, bboxes, prob, rotate, func_changes_bbox, degrees, rep...
9,211,649,917,027,160,000
Apply rotate to each bbox in the image with probability prob.
efficientdet/aug/autoaugment.py
rotate_only_bboxes
datawowio/automl
python
def rotate_only_bboxes(image, bboxes, prob, degrees, replace): func_changes_bbox = False prob = _scale_bbox_only_op_probability(prob) return _apply_multi_bbox_augmentation_wrapper(image, bboxes, prob, rotate, func_changes_bbox, degrees, replace)
def shear_x_only_bboxes(image, bboxes, prob, level, replace): 'Apply shear_x to each bbox in the image with probability prob.' func_changes_bbox = False prob = _scale_bbox_only_op_probability(prob) return _apply_multi_bbox_augmentation_wrapper(image, bboxes, prob, shear_x, func_changes_bbox, level, repl...
5,920,012,366,805,690,000
Apply shear_x to each bbox in the image with probability prob.
efficientdet/aug/autoaugment.py
shear_x_only_bboxes
datawowio/automl
python
def shear_x_only_bboxes(image, bboxes, prob, level, replace): func_changes_bbox = False prob = _scale_bbox_only_op_probability(prob) return _apply_multi_bbox_augmentation_wrapper(image, bboxes, prob, shear_x, func_changes_bbox, level, replace)
def shear_y_only_bboxes(image, bboxes, prob, level, replace): 'Apply shear_y to each bbox in the image with probability prob.' func_changes_bbox = False prob = _scale_bbox_only_op_probability(prob) return _apply_multi_bbox_augmentation_wrapper(image, bboxes, prob, shear_y, func_changes_bbox, level, repl...
7,922,629,001,002,101,000
Apply shear_y to each bbox in the image with probability prob.
efficientdet/aug/autoaugment.py
shear_y_only_bboxes
datawowio/automl
python
def shear_y_only_bboxes(image, bboxes, prob, level, replace): func_changes_bbox = False prob = _scale_bbox_only_op_probability(prob) return _apply_multi_bbox_augmentation_wrapper(image, bboxes, prob, shear_y, func_changes_bbox, level, replace)
def translate_x_only_bboxes(image, bboxes, prob, pixels, replace): 'Apply translate_x to each bbox in the image with probability prob.' func_changes_bbox = False prob = _scale_bbox_only_op_probability(prob) return _apply_multi_bbox_augmentation_wrapper(image, bboxes, prob, translate_x, func_changes_bbox...
-460,229,343,365,831,800
Apply translate_x to each bbox in the image with probability prob.
efficientdet/aug/autoaugment.py
translate_x_only_bboxes
datawowio/automl
python
def translate_x_only_bboxes(image, bboxes, prob, pixels, replace): func_changes_bbox = False prob = _scale_bbox_only_op_probability(prob) return _apply_multi_bbox_augmentation_wrapper(image, bboxes, prob, translate_x, func_changes_bbox, pixels, replace)
def translate_y_only_bboxes(image, bboxes, prob, pixels, replace): 'Apply translate_y to each bbox in the image with probability prob.' func_changes_bbox = False prob = _scale_bbox_only_op_probability(prob) return _apply_multi_bbox_augmentation_wrapper(image, bboxes, prob, translate_y, func_changes_bbox...
-888,010,208,539,744,100
Apply translate_y to each bbox in the image with probability prob.
efficientdet/aug/autoaugment.py
translate_y_only_bboxes
datawowio/automl
python
def translate_y_only_bboxes(image, bboxes, prob, pixels, replace): func_changes_bbox = False prob = _scale_bbox_only_op_probability(prob) return _apply_multi_bbox_augmentation_wrapper(image, bboxes, prob, translate_y, func_changes_bbox, pixels, replace)
def flip_only_bboxes(image, bboxes, prob): 'Apply flip_lr to each bbox in the image with probability prob.' func_changes_bbox = False prob = _scale_bbox_only_op_probability(prob) return _apply_multi_bbox_augmentation_wrapper(image, bboxes, prob, tf.image.flip_left_right, func_changes_bbox)
-5,039,183,936,218,054,000
Apply flip_lr to each bbox in the image with probability prob.
efficientdet/aug/autoaugment.py
flip_only_bboxes
datawowio/automl
python
def flip_only_bboxes(image, bboxes, prob): func_changes_bbox = False prob = _scale_bbox_only_op_probability(prob) return _apply_multi_bbox_augmentation_wrapper(image, bboxes, prob, tf.image.flip_left_right, func_changes_bbox)
def solarize_only_bboxes(image, bboxes, prob, threshold): 'Apply solarize to each bbox in the image with probability prob.' func_changes_bbox = False prob = _scale_bbox_only_op_probability(prob) return _apply_multi_bbox_augmentation_wrapper(image, bboxes, prob, solarize, func_changes_bbox, threshold)
-7,773,348,117,398,861,000
Apply solarize to each bbox in the image with probability prob.
efficientdet/aug/autoaugment.py
solarize_only_bboxes
datawowio/automl
python
def solarize_only_bboxes(image, bboxes, prob, threshold): func_changes_bbox = False prob = _scale_bbox_only_op_probability(prob) return _apply_multi_bbox_augmentation_wrapper(image, bboxes, prob, solarize, func_changes_bbox, threshold)
def equalize_only_bboxes(image, bboxes, prob): 'Apply equalize to each bbox in the image with probability prob.' func_changes_bbox = False prob = _scale_bbox_only_op_probability(prob) return _apply_multi_bbox_augmentation_wrapper(image, bboxes, prob, equalize, func_changes_bbox)
-6,543,237,160,596,510,000
Apply equalize to each bbox in the image with probability prob.
efficientdet/aug/autoaugment.py
equalize_only_bboxes
datawowio/automl
python
def equalize_only_bboxes(image, bboxes, prob): func_changes_bbox = False prob = _scale_bbox_only_op_probability(prob) return _apply_multi_bbox_augmentation_wrapper(image, bboxes, prob, equalize, func_changes_bbox)
def cutout_only_bboxes(image, bboxes, prob, pad_size, replace): 'Apply cutout to each bbox in the image with probability prob.' func_changes_bbox = False prob = _scale_bbox_only_op_probability(prob) return _apply_multi_bbox_augmentation_wrapper(image, bboxes, prob, cutout, func_changes_bbox, pad_size, r...
-2,471,233,948,783,666,000
Apply cutout to each bbox in the image with probability prob.
efficientdet/aug/autoaugment.py
cutout_only_bboxes
datawowio/automl
python
def cutout_only_bboxes(image, bboxes, prob, pad_size, replace): func_changes_bbox = False prob = _scale_bbox_only_op_probability(prob) return _apply_multi_bbox_augmentation_wrapper(image, bboxes, prob, cutout, func_changes_bbox, pad_size, replace)
def _rotate_bbox(bbox, image_height, image_width, degrees): 'Rotates the bbox coordinated by degrees.\n\n Args:\n bbox: 1D Tensor that has 4 elements (min_y, min_x, max_y, max_x)\n of type float that represents the normalized coordinates between 0 and 1.\n image_height: Int, height of the image.\n im...
6,211,981,566,521,351,000
Rotates the bbox coordinated by degrees. Args: bbox: 1D Tensor that has 4 elements (min_y, min_x, max_y, max_x) of type float that represents the normalized coordinates between 0 and 1. image_height: Int, height of the image. image_width: Int, height of the image. degrees: Float, a scalar angle in degrees ...
efficientdet/aug/autoaugment.py
_rotate_bbox
datawowio/automl
python
def _rotate_bbox(bbox, image_height, image_width, degrees): 'Rotates the bbox coordinated by degrees.\n\n Args:\n bbox: 1D Tensor that has 4 elements (min_y, min_x, max_y, max_x)\n of type float that represents the normalized coordinates between 0 and 1.\n image_height: Int, height of the image.\n im...
def rotate_with_bboxes(image, bboxes, degrees, replace): 'Equivalent of PIL Rotate that rotates the image and bbox.\n\n Args:\n image: 3D uint8 Tensor.\n bboxes: 2D Tensor that is a list of the bboxes in the image. Each bbox\n has 4 elements (min_y, min_x, max_y, max_x) of type float.\n degrees: Floa...
-3,447,364,672,112,616,400
Equivalent of PIL Rotate that rotates the image and bbox. Args: image: 3D uint8 Tensor. bboxes: 2D Tensor that is a list of the bboxes in the image. Each bbox has 4 elements (min_y, min_x, max_y, max_x) of type float. degrees: Float, a scalar angle in degrees to rotate all images by. If degrees is positi...
efficientdet/aug/autoaugment.py
rotate_with_bboxes
datawowio/automl
python
def rotate_with_bboxes(image, bboxes, degrees, replace): 'Equivalent of PIL Rotate that rotates the image and bbox.\n\n Args:\n image: 3D uint8 Tensor.\n bboxes: 2D Tensor that is a list of the bboxes in the image. Each bbox\n has 4 elements (min_y, min_x, max_y, max_x) of type float.\n degrees: Floa...
def translate_x(image, pixels, replace): 'Equivalent of PIL Translate in X dimension.' image = image_ops.translate(wrap(image), [(- pixels), 0]) return unwrap(image, replace)
-3,514,625,783,606,751,000
Equivalent of PIL Translate in X dimension.
efficientdet/aug/autoaugment.py
translate_x
datawowio/automl
python
def translate_x(image, pixels, replace): image = image_ops.translate(wrap(image), [(- pixels), 0]) return unwrap(image, replace)
def translate_y(image, pixels, replace): 'Equivalent of PIL Translate in Y dimension.' image = image_ops.translate(wrap(image), [0, (- pixels)]) return unwrap(image, replace)
-3,311,760,775,496,658,400
Equivalent of PIL Translate in Y dimension.
efficientdet/aug/autoaugment.py
translate_y
datawowio/automl
python
def translate_y(image, pixels, replace): image = image_ops.translate(wrap(image), [0, (- pixels)]) return unwrap(image, replace)
def _shift_bbox(bbox, image_height, image_width, pixels, shift_horizontal): 'Shifts the bbox coordinates by pixels.\n\n Args:\n bbox: 1D Tensor that has 4 elements (min_y, min_x, max_y, max_x)\n of type float that represents the normalized coordinates between 0 and 1.\n image_height: Int, height of the ...
-6,072,056,995,610,296,000
Shifts the bbox coordinates by pixels. Args: bbox: 1D Tensor that has 4 elements (min_y, min_x, max_y, max_x) of type float that represents the normalized coordinates between 0 and 1. image_height: Int, height of the image. image_width: Int, width of the image. pixels: An int. How many pixels to shift the ...
efficientdet/aug/autoaugment.py
_shift_bbox
datawowio/automl
python
def _shift_bbox(bbox, image_height, image_width, pixels, shift_horizontal): 'Shifts the bbox coordinates by pixels.\n\n Args:\n bbox: 1D Tensor that has 4 elements (min_y, min_x, max_y, max_x)\n of type float that represents the normalized coordinates between 0 and 1.\n image_height: Int, height of the ...
def translate_bbox(image, bboxes, pixels, replace, shift_horizontal): 'Equivalent of PIL Translate in X/Y dimension that shifts image and bbox.\n\n Args:\n image: 3D uint8 Tensor.\n bboxes: 2D Tensor that is a list of the bboxes in the image. Each bbox\n has 4 elements (min_y, min_x, max_y, max_x) of ty...
-1,837,703,549,154,977,800
Equivalent of PIL Translate in X/Y dimension that shifts image and bbox. Args: image: 3D uint8 Tensor. bboxes: 2D Tensor that is a list of the bboxes in the image. Each bbox has 4 elements (min_y, min_x, max_y, max_x) of type float with values between [0, 1]. pixels: An int. How many pixels to shift the ...
efficientdet/aug/autoaugment.py
translate_bbox
datawowio/automl
python
def translate_bbox(image, bboxes, pixels, replace, shift_horizontal): 'Equivalent of PIL Translate in X/Y dimension that shifts image and bbox.\n\n Args:\n image: 3D uint8 Tensor.\n bboxes: 2D Tensor that is a list of the bboxes in the image. Each bbox\n has 4 elements (min_y, min_x, max_y, max_x) of ty...
def shear_x(image, level, replace): 'Equivalent of PIL Shearing in X dimension.' image = image_ops.transform(wrap(image), [1.0, level, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0]) return unwrap(image, replace)
-6,123,410,436,435,485,000
Equivalent of PIL Shearing in X dimension.
efficientdet/aug/autoaugment.py
shear_x
datawowio/automl
python
def shear_x(image, level, replace): image = image_ops.transform(wrap(image), [1.0, level, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0]) return unwrap(image, replace)
def shear_y(image, level, replace): 'Equivalent of PIL Shearing in Y dimension.' image = image_ops.transform(wrap(image), [1.0, 0.0, 0.0, level, 1.0, 0.0, 0.0, 0.0]) return unwrap(image, replace)
-7,747,551,437,542,087,000
Equivalent of PIL Shearing in Y dimension.
efficientdet/aug/autoaugment.py
shear_y
datawowio/automl
python
def shear_y(image, level, replace): image = image_ops.transform(wrap(image), [1.0, 0.0, 0.0, level, 1.0, 0.0, 0.0, 0.0]) return unwrap(image, replace)
def _shear_bbox(bbox, image_height, image_width, level, shear_horizontal): 'Shifts the bbox according to how the image was sheared.\n\n Args:\n bbox: 1D Tensor that has 4 elements (min_y, min_x, max_y, max_x)\n of type float that represents the normalized coordinates between 0 and 1.\n image_height: Int...
-6,425,782,020,536,974,000
Shifts the bbox according to how the image was sheared. Args: bbox: 1D Tensor that has 4 elements (min_y, min_x, max_y, max_x) of type float that represents the normalized coordinates between 0 and 1. image_height: Int, height of the image. image_width: Int, height of the image. level: Float. How much to s...
efficientdet/aug/autoaugment.py
_shear_bbox
datawowio/automl
python
def _shear_bbox(bbox, image_height, image_width, level, shear_horizontal): 'Shifts the bbox according to how the image was sheared.\n\n Args:\n bbox: 1D Tensor that has 4 elements (min_y, min_x, max_y, max_x)\n of type float that represents the normalized coordinates between 0 and 1.\n image_height: Int...
def shear_with_bboxes(image, bboxes, level, replace, shear_horizontal): 'Applies Shear Transformation to the image and shifts the bboxes.\n\n Args:\n image: 3D uint8 Tensor.\n bboxes: 2D Tensor that is a list of the bboxes in the image. Each bbox\n has 4 elements (min_y, min_x, max_y, max_x) of type flo...
-8,922,601,394,061,101,000
Applies Shear Transformation to the image and shifts the bboxes. Args: image: 3D uint8 Tensor. bboxes: 2D Tensor that is a list of the bboxes in the image. Each bbox has 4 elements (min_y, min_x, max_y, max_x) of type float with values between [0, 1]. level: Float. How much to shear the image. This value...
efficientdet/aug/autoaugment.py
shear_with_bboxes
datawowio/automl
python
def shear_with_bboxes(image, bboxes, level, replace, shear_horizontal): 'Applies Shear Transformation to the image and shifts the bboxes.\n\n Args:\n image: 3D uint8 Tensor.\n bboxes: 2D Tensor that is a list of the bboxes in the image. Each bbox\n has 4 elements (min_y, min_x, max_y, max_x) of type flo...
def autocontrast(image): 'Implements Autocontrast function from PIL using TF ops.\n\n Args:\n image: A 3D uint8 tensor.\n\n Returns:\n The image after it has had autocontrast applied to it and will be of type\n uint8.\n ' def scale_channel(image): 'Scale the 2D image using the autocontrast ...
303,571,217,608,186,900
Implements Autocontrast function from PIL using TF ops. Args: image: A 3D uint8 tensor. Returns: The image after it has had autocontrast applied to it and will be of type uint8.
efficientdet/aug/autoaugment.py
autocontrast
datawowio/automl
python
def autocontrast(image): 'Implements Autocontrast function from PIL using TF ops.\n\n Args:\n image: A 3D uint8 tensor.\n\n Returns:\n The image after it has had autocontrast applied to it and will be of type\n uint8.\n ' def scale_channel(image): 'Scale the 2D image using the autocontrast ...
def sharpness(image, factor): 'Implements Sharpness function from PIL using TF ops.' orig_image = image image = tf.cast(image, tf.float32) image = tf.expand_dims(image, 0) kernel = (tf.constant([[1, 1, 1], [1, 5, 1], [1, 1, 1]], dtype=tf.float32, shape=[3, 3, 1, 1]) / 13.0) kernel = tf.tile(kern...
-1,232,677,706,748,177,200
Implements Sharpness function from PIL using TF ops.
efficientdet/aug/autoaugment.py
sharpness
datawowio/automl
python
def sharpness(image, factor): orig_image = image image = tf.cast(image, tf.float32) image = tf.expand_dims(image, 0) kernel = (tf.constant([[1, 1, 1], [1, 5, 1], [1, 1, 1]], dtype=tf.float32, shape=[3, 3, 1, 1]) / 13.0) kernel = tf.tile(kernel, [1, 1, 3, 1]) strides = [1, 1, 1, 1] with ...
def equalize(image): 'Implements Equalize function from PIL using TF ops.' def scale_channel(im, c): 'Scale the data in the channel to implement equalize.' im = tf.cast(im[:, :, c], tf.int32) histo = tf.histogram_fixed_width(im, [0, 255], nbins=256) nonzero = tf.where(tf.not_equ...
-4,360,158,787,895,066,600
Implements Equalize function from PIL using TF ops.
efficientdet/aug/autoaugment.py
equalize
datawowio/automl
python
def equalize(image): def scale_channel(im, c): 'Scale the data in the channel to implement equalize.' im = tf.cast(im[:, :, c], tf.int32) histo = tf.histogram_fixed_width(im, [0, 255], nbins=256) nonzero = tf.where(tf.not_equal(histo, 0)) nonzero_histo = tf.reshape(tf.g...
def wrap(image): "Returns 'image' with an extra channel set to all 1s." shape = tf.shape(image) extended_channel = tf.ones([shape[0], shape[1], 1], image.dtype) extended = tf.concat([image, extended_channel], 2) return extended
-2,054,740,842,410,237,000
Returns 'image' with an extra channel set to all 1s.
efficientdet/aug/autoaugment.py
wrap
datawowio/automl
python
def wrap(image): shape = tf.shape(image) extended_channel = tf.ones([shape[0], shape[1], 1], image.dtype) extended = tf.concat([image, extended_channel], 2) return extended
def unwrap(image, replace): "Unwraps an image produced by wrap.\n\n Where there is a 0 in the last channel for every spatial position,\n the rest of the three channels in that spatial dimension are grayed\n (set to 128). Operations like translate and shear on a wrapped\n Tensor will leave 0s in empty locations...
6,263,443,170,076,591,000
Unwraps an image produced by wrap. Where there is a 0 in the last channel for every spatial position, the rest of the three channels in that spatial dimension are grayed (set to 128). Operations like translate and shear on a wrapped Tensor will leave 0s in empty locations. Some transformations look at the intensity ...
efficientdet/aug/autoaugment.py
unwrap
datawowio/automl
python
def unwrap(image, replace): "Unwraps an image produced by wrap.\n\n Where there is a 0 in the last channel for every spatial position,\n the rest of the three channels in that spatial dimension are grayed\n (set to 128). Operations like translate and shear on a wrapped\n Tensor will leave 0s in empty locations...
def _cutout_inside_bbox(image, bbox, pad_fraction): 'Generates cutout mask and the mean pixel value of the bbox.\n\n First a location is randomly chosen within the image as the center where the\n cutout mask will be applied. Note this can be towards the boundaries of the\n image, so the full cutout mask may not ...
-8,068,290,216,123,599,000
Generates cutout mask and the mean pixel value of the bbox. First a location is randomly chosen within the image as the center where the cutout mask will be applied. Note this can be towards the boundaries of the image, so the full cutout mask may not be applied. Args: image: 3D uint8 Tensor. bbox: 1D Tensor that...
efficientdet/aug/autoaugment.py
_cutout_inside_bbox
datawowio/automl
python
def _cutout_inside_bbox(image, bbox, pad_fraction): 'Generates cutout mask and the mean pixel value of the bbox.\n\n First a location is randomly chosen within the image as the center where the\n cutout mask will be applied. Note this can be towards the boundaries of the\n image, so the full cutout mask may not ...
def bbox_cutout(image, bboxes, pad_fraction, replace_with_mean): 'Applies cutout to the image according to bbox information.\n\n This is a cutout variant that using bbox information to make more informed\n decisions on where to place the cutout mask.\n\n Args:\n image: 3D uint8 Tensor.\n bboxes: 2D Tensor ...
3,325,208,541,111,828,000
Applies cutout to the image according to bbox information. This is a cutout variant that using bbox information to make more informed decisions on where to place the cutout mask. Args: image: 3D uint8 Tensor. bboxes: 2D Tensor that is a list of the bboxes in the image. Each bbox has 4 elements (min_y, min_x, ...
efficientdet/aug/autoaugment.py
bbox_cutout
datawowio/automl
python
def bbox_cutout(image, bboxes, pad_fraction, replace_with_mean): 'Applies cutout to the image according to bbox information.\n\n This is a cutout variant that using bbox information to make more informed\n decisions on where to place the cutout mask.\n\n Args:\n image: 3D uint8 Tensor.\n bboxes: 2D Tensor ...
def _randomly_negate_tensor(tensor): 'With 50% prob turn the tensor negative.' should_flip = tf.cast(tf.floor((tf.random_uniform([]) + 0.5)), tf.bool) final_tensor = tf.cond(should_flip, (lambda : tensor), (lambda : (- tensor))) return final_tensor
7,650,776,648,965,303,000
With 50% prob turn the tensor negative.
efficientdet/aug/autoaugment.py
_randomly_negate_tensor
datawowio/automl
python
def _randomly_negate_tensor(tensor): should_flip = tf.cast(tf.floor((tf.random_uniform([]) + 0.5)), tf.bool) final_tensor = tf.cond(should_flip, (lambda : tensor), (lambda : (- tensor))) return final_tensor
def _shrink_level_to_arg(level): 'Converts level to ratio by which we shrink the image content.' if (level == 0): return (1.0,) level = ((2.0 / (_MAX_LEVEL / level)) + 0.9) return (level,)
9,177,563,595,245,319,000
Converts level to ratio by which we shrink the image content.
efficientdet/aug/autoaugment.py
_shrink_level_to_arg
datawowio/automl
python
def _shrink_level_to_arg(level): if (level == 0): return (1.0,) level = ((2.0 / (_MAX_LEVEL / level)) + 0.9) return (level,)
def bbox_wrapper(func): 'Adds a bboxes function argument to func and returns unchanged bboxes.' def wrapper(images, bboxes, *args, **kwargs): return (func(images, *args, **kwargs), bboxes) return wrapper
7,986,334,951,161,487,000
Adds a bboxes function argument to func and returns unchanged bboxes.
efficientdet/aug/autoaugment.py
bbox_wrapper
datawowio/automl
python
def bbox_wrapper(func): def wrapper(images, bboxes, *args, **kwargs): return (func(images, *args, **kwargs), bboxes) return wrapper
def _parse_policy_info(name, prob, level, replace_value, augmentation_hparams): 'Return the function that corresponds to `name` and update `level` param.' func = NAME_TO_FUNC[name] args = level_to_arg(augmentation_hparams)[name](level) if ('prob' in inspect.getfullargspec(func)[0]): args = tuple...
1,299,395,002,175,213,300
Return the function that corresponds to `name` and update `level` param.
efficientdet/aug/autoaugment.py
_parse_policy_info
datawowio/automl
python
def _parse_policy_info(name, prob, level, replace_value, augmentation_hparams): func = NAME_TO_FUNC[name] args = level_to_arg(augmentation_hparams)[name](level) if ('prob' in inspect.getfullargspec(func)[0]): args = tuple(([prob] + list(args))) if ('replace' in inspect.getfullargspec(func)[...
def _apply_func_with_prob(func, image, args, prob, bboxes): 'Apply `func` to image w/ `args` as input with probability `prob`.' assert isinstance(args, tuple) assert ('bboxes' == inspect.getfullargspec(func)[0][1]) if ('prob' in inspect.getfullargspec(func)[0]): prob = 1.0 should_apply_op = ...
-935,833,796,455,203,700
Apply `func` to image w/ `args` as input with probability `prob`.
efficientdet/aug/autoaugment.py
_apply_func_with_prob
datawowio/automl
python
def _apply_func_with_prob(func, image, args, prob, bboxes): assert isinstance(args, tuple) assert ('bboxes' == inspect.getfullargspec(func)[0][1]) if ('prob' in inspect.getfullargspec(func)[0]): prob = 1.0 should_apply_op = tf.cast(tf.floor((tf.random_uniform([], dtype=tf.float32) + prob)),...
def select_and_apply_random_policy(policies, image, bboxes): 'Select a random policy from `policies` and apply it to `image`.' policy_to_select = tf.random_uniform([], maxval=len(policies), dtype=tf.int32) for (i, policy) in enumerate(policies): (image, bboxes) = tf.cond(tf.equal(i, policy_to_select...
-2,167,437,932,029,373,700
Select a random policy from `policies` and apply it to `image`.
efficientdet/aug/autoaugment.py
select_and_apply_random_policy
datawowio/automl
python
def select_and_apply_random_policy(policies, image, bboxes): policy_to_select = tf.random_uniform([], maxval=len(policies), dtype=tf.int32) for (i, policy) in enumerate(policies): (image, bboxes) = tf.cond(tf.equal(i, policy_to_select), (lambda selected_policy=policy: selected_policy(image, bboxes)...
def build_and_apply_nas_policy(policies, image, bboxes, augmentation_hparams): 'Build a policy from the given policies passed in and apply to image.\n\n Args:\n policies: list of lists of tuples in the form `(func, prob, level)`, `func`\n is a string name of the augmentation function, `prob` is the probabi...
-5,391,226,156,041,492,000
Build a policy from the given policies passed in and apply to image. Args: policies: list of lists of tuples in the form `(func, prob, level)`, `func` is a string name of the augmentation function, `prob` is the probability of applying the `func` operation, `level` is the input argument for `func`. ima...
efficientdet/aug/autoaugment.py
build_and_apply_nas_policy
datawowio/automl
python
def build_and_apply_nas_policy(policies, image, bboxes, augmentation_hparams): 'Build a policy from the given policies passed in and apply to image.\n\n Args:\n policies: list of lists of tuples in the form `(func, prob, level)`, `func`\n is a string name of the augmentation function, `prob` is the probabi...
@tf.autograph.experimental.do_not_convert def distort_image_with_autoaugment(image, bboxes, augmentation_name): 'Applies the AutoAugment policy to `image` and `bboxes`.\n\n Args:\n image: `Tensor` of shape [height, width, 3] representing an image.\n bboxes: `Tensor` of shape [N, 4] representing ground truth ...
6,681,142,781,319,894,000
Applies the AutoAugment policy to `image` and `bboxes`. Args: image: `Tensor` of shape [height, width, 3] representing an image. bboxes: `Tensor` of shape [N, 4] representing ground truth boxes that are normalized between [0, 1]. augmentation_name: The name of the AutoAugment policy to use. The available ...
efficientdet/aug/autoaugment.py
distort_image_with_autoaugment
datawowio/automl
python
@tf.autograph.experimental.do_not_convert def distort_image_with_autoaugment(image, bboxes, augmentation_name): 'Applies the AutoAugment policy to `image` and `bboxes`.\n\n Args:\n image: `Tensor` of shape [height, width, 3] representing an image.\n bboxes: `Tensor` of shape [N, 4] representing ground truth ...
def distort_image_with_randaugment(image, bboxes, num_layers, magnitude): 'Applies the RandAugment to `image` and `bboxes`.' replace_value = [128, 128, 128] tf.logging.info('Using RandAugment.') augmentation_hparams = hparams_config.Config(dict(cutout_max_pad_fraction=0.75, cutout_bbox_replace_with_mean...
6,479,833,031,204,732,000
Applies the RandAugment to `image` and `bboxes`.
efficientdet/aug/autoaugment.py
distort_image_with_randaugment
datawowio/automl
python
def distort_image_with_randaugment(image, bboxes, num_layers, magnitude): replace_value = [128, 128, 128] tf.logging.info('Using RandAugment.') augmentation_hparams = hparams_config.Config(dict(cutout_max_pad_fraction=0.75, cutout_bbox_replace_with_mean=False, cutout_const=100, translate_const=250, cut...
def mask_and_add_image(min_y_, min_x_, max_y_, max_x_, mask, content_tensor, image_): 'Applies mask to bbox region in image then adds content_tensor to it.' mask = tf.pad(mask, [[min_y_, ((image_height - 1) - max_y_)], [min_x_, ((image_width - 1) - max_x_)], [0, 0]], constant_values=1) content_tensor = tf.p...
-1,229,225,343,436,366,000
Applies mask to bbox region in image then adds content_tensor to it.
efficientdet/aug/autoaugment.py
mask_and_add_image
datawowio/automl
python
def mask_and_add_image(min_y_, min_x_, max_y_, max_x_, mask, content_tensor, image_): mask = tf.pad(mask, [[min_y_, ((image_height - 1) - max_y_)], [min_x_, ((image_width - 1) - max_x_)], [0, 0]], constant_values=1) content_tensor = tf.pad(content_tensor, [[min_y_, ((image_height - 1) - max_y_)], [min_x_, ...
def scale_channel(image): 'Scale the 2D image using the autocontrast rule.' lo = tf.to_float(tf.reduce_min(image)) hi = tf.to_float(tf.reduce_max(image)) def scale_values(im): scale = (255.0 / (hi - lo)) offset = ((- lo) * scale) im = ((tf.to_float(im) * scale) + offset) ...
1,234,125,559,131,667,000
Scale the 2D image using the autocontrast rule.
efficientdet/aug/autoaugment.py
scale_channel
datawowio/automl
python
def scale_channel(image): lo = tf.to_float(tf.reduce_min(image)) hi = tf.to_float(tf.reduce_max(image)) def scale_values(im): scale = (255.0 / (hi - lo)) offset = ((- lo) * scale) im = ((tf.to_float(im) * scale) + offset) im = tf.clip_by_value(im, 0.0, 255.0) re...
def scale_channel(im, c): 'Scale the data in the channel to implement equalize.' im = tf.cast(im[:, :, c], tf.int32) histo = tf.histogram_fixed_width(im, [0, 255], nbins=256) nonzero = tf.where(tf.not_equal(histo, 0)) nonzero_histo = tf.reshape(tf.gather(histo, nonzero), [(- 1)]) step = ((tf.red...
6,353,019,026,156,998,000
Scale the data in the channel to implement equalize.
efficientdet/aug/autoaugment.py
scale_channel
datawowio/automl
python
def scale_channel(im, c): im = tf.cast(im[:, :, c], tf.int32) histo = tf.histogram_fixed_width(im, [0, 255], nbins=256) nonzero = tf.where(tf.not_equal(histo, 0)) nonzero_histo = tf.reshape(tf.gather(histo, nonzero), [(- 1)]) step = ((tf.reduce_sum(nonzero_histo) - nonzero_histo[(- 1)]) // 255)...