megadetector 5.0.23__py3-none-any.whl → 5.0.25__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of megadetector might be problematic. Click here for more details.

Files changed (42) hide show
  1. megadetector/api/synchronous/api_core/animal_detection_api/api_backend.py +2 -3
  2. megadetector/classification/merge_classification_detection_output.py +2 -2
  3. megadetector/data_management/coco_to_labelme.py +2 -1
  4. megadetector/data_management/databases/integrity_check_json_db.py +15 -14
  5. megadetector/data_management/databases/subset_json_db.py +49 -21
  6. megadetector/data_management/lila/add_locations_to_island_camera_traps.py +73 -69
  7. megadetector/data_management/lila/add_locations_to_nacti.py +114 -110
  8. megadetector/data_management/mewc_to_md.py +340 -0
  9. megadetector/data_management/speciesnet_to_md.py +41 -0
  10. megadetector/data_management/yolo_output_to_md_output.py +15 -8
  11. megadetector/detection/process_video.py +24 -7
  12. megadetector/detection/pytorch_detector.py +841 -160
  13. megadetector/detection/run_detector.py +341 -146
  14. megadetector/detection/run_detector_batch.py +307 -70
  15. megadetector/detection/run_inference_with_yolov5_val.py +61 -4
  16. megadetector/detection/tf_detector.py +6 -1
  17. megadetector/postprocessing/{combine_api_outputs.py → combine_batch_outputs.py} +10 -13
  18. megadetector/postprocessing/compare_batch_results.py +236 -7
  19. megadetector/postprocessing/create_crop_folder.py +358 -0
  20. megadetector/postprocessing/md_to_labelme.py +7 -7
  21. megadetector/postprocessing/md_to_wi.py +40 -0
  22. megadetector/postprocessing/merge_detections.py +1 -1
  23. megadetector/postprocessing/postprocess_batch_results.py +12 -5
  24. megadetector/postprocessing/separate_detections_into_folders.py +32 -4
  25. megadetector/postprocessing/validate_batch_results.py +9 -4
  26. megadetector/utils/ct_utils.py +236 -45
  27. megadetector/utils/directory_listing.py +3 -3
  28. megadetector/utils/gpu_test.py +125 -0
  29. megadetector/utils/md_tests.py +455 -116
  30. megadetector/utils/path_utils.py +43 -2
  31. megadetector/utils/wi_utils.py +2691 -0
  32. megadetector/visualization/visualization_utils.py +95 -18
  33. megadetector/visualization/visualize_db.py +25 -7
  34. megadetector/visualization/visualize_detector_output.py +60 -13
  35. {megadetector-5.0.23.dist-info → megadetector-5.0.25.dist-info}/METADATA +11 -23
  36. {megadetector-5.0.23.dist-info → megadetector-5.0.25.dist-info}/RECORD +39 -36
  37. {megadetector-5.0.23.dist-info → megadetector-5.0.25.dist-info}/WHEEL +1 -1
  38. megadetector/detection/detector_training/__init__.py +0 -0
  39. megadetector/detection/detector_training/model_main_tf2.py +0 -114
  40. megadetector/utils/torch_test.py +0 -32
  41. {megadetector-5.0.23.dist-info → megadetector-5.0.25.dist-info}/LICENSE +0 -0
  42. {megadetector-5.0.23.dist-info → megadetector-5.0.25.dist-info}/top_level.txt +0 -0
@@ -533,15 +533,56 @@ def wsl_path_to_windows_path(filename):
533
533
  filename (str): filename to convert
534
534
 
535
535
  Returns:
536
- str: Windows equivalent to the WSL path [filename]
536
+ str: Windows equivalent to the WSL path [filename], or [filename] if the current
537
+ environment is neither Windows nor WSL.
537
538
  """
538
539
 
539
- result = subprocess.run(['wslpath', '-w', filename], text=True, capture_output=True)
540
+ if (not environment_is_wsl()) and (os.name != 'nt'):
541
+ return filename
542
+
543
+ if environment_is_wsl():
544
+ result = subprocess.run(['wslpath', '-w', filename], text=True, capture_output=True)
545
+ else:
546
+ result = subprocess.run(['wsl', 'wslpath', '-w', filename], text=True, capture_output=True)
540
547
  if result.returncode != 0:
541
548
  print('Could not convert path {} from WSL to Windows'.format(filename))
542
549
  return None
550
+
543
551
  return result.stdout.strip()
544
552
 
553
+
554
+ def windows_path_to_wsl_path(filename):
555
+ r"""
556
+ Converts a Windows path to a WSL path, or returns None if that's not possible. E.g.
557
+ converts:
558
+
559
+ e:\a\b\c
560
+
561
+ ...to:
562
+
563
+ /mnt/e/a/b/c
564
+
565
+ Args:
566
+ filename (str): filename to convert
567
+
568
+ Returns:
569
+ str: WSL equivalent to the Windows path [filename], or [filename] if the current
570
+ environment is neither Windows nor WSL.
571
+ """
572
+
573
+ if (not environment_is_wsl()) and (os.name != 'nt'):
574
+ return filename
575
+
576
+ if environment_is_wsl():
577
+ result = subprocess.run(['wslpath', '-u', filename], text=True, capture_output=True)
578
+ else:
579
+ result = subprocess.run(['wsl', 'wslpath', '-u', filename], text=True, capture_output=True)
580
+ if result.returncode != 0:
581
+ print('Could not convert path {} from Windows to WSL'.format(filename))
582
+ return None
583
+
584
+ return result.stdout.strip()
585
+
545
586
 
546
587
  def open_file(filename, attempt_to_open_in_wsl_host=False, browser_name=None):
547
588
  """