.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "bluetooth/bluetooth_localization_tutorial.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_bluetooth_bluetooth_localization_tutorial.py: Bluetooth Localization Tutorial =============================== .. GENERATED FROM PYTHON SOURCE LINES 7-10 .. code-block:: Python # !pip install pysensing .. GENERATED FROM PYTHON SOURCE LINES 11-13 This is the tutoral for Bluetooth RSSI Based Localization using Fingerprinting Methods .. GENERATED FROM PYTHON SOURCE LINES 13-22 .. code-block:: Python import torch from torch.optim import Adam, SGD from pysensing.bluetooth.datasets.wmu_ble_loc import get_dataloader_wmubleloc from pysensing.bluetooth.datasets.amazonas_indoor_env import get_dataloader_amazonasindoorenv from pysensing.bluetooth.models.localization.fingerprinting import MLP, CNN, WKNN, LSTM from pysensing.acoustic.datasets.get_dataloader import download_and_extract import warnings warnings.filterwarnings('ignore') .. GENERATED FROM PYTHON SOURCE LINES 23-25 Data download links ----------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 25-30 .. code-block:: Python dataset_url = { 'WMUBLELoc': 'https://pysensing.oss-ap-southeast-1.aliyuncs.com/data/ble/WMUBLELoc.zip', 'Amazonas':'https://pysensing.oss-ap-southeast-1.aliyuncs.com/data/ble/AmazonasIndoorEnv.zip' } .. GENERATED FROM PYTHON SOURCE LINES 31-33 Load the WMU BLE Localization Data ------------------------ .. GENERATED FROM PYTHON SOURCE LINES 33-43 .. code-block:: Python data_dir = './WMUBLELoc' # download the dataset if the dataset have not been download download_and_extract(dataset_url['WMUBLELoc'],data_dir) wmu_path = "./WMUBLELoc/iBeacon_RSSI_Labeled.csv" loader_train = get_dataloader_wmubleloc(wmu_path, batch_size=32, is_train=True, train_seed=0) n_samples_train = len(loader_train.dataset) loader_test = get_dataloader_wmubleloc(wmu_path, batch_size=32, is_train=False, train_seed=0) n_samples_test = len(loader_test.dataset) .. rst-class:: sphx-glr-script-out .. code-block:: none Downloading https://pysensing.oss-ap-southeast-1.aliyuncs.com/data/ble/WMUBLELoc.zip ... Downloading: 0%| | 0.00/150k [00:00` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: bluetooth_localization_tutorial.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_