Project dependencies may have API risk issues
Hi, In mlsd_pytorch, inappropriate dependency versioning constraints can cause risks.
Below are the dependencies and version constraints that the project is using
numpy
opencv-python
pillow
torch
Flask
requests
The version constraint == will introduce the risk of dependency conflicts because the scope of dependencies is too strict. The version constraint No Upper Bound and * will introduce the risk of the missing API Error because the latest version of the dependencies may remove some APIs.
After further analysis, in this project, The version constraint of dependency numpy can be changed to >=1.8.0,<=1.23.0rc3. The version constraint of dependency pillow can be changed to ==9.2.0. The version constraint of dependency pillow can be changed to >=2.0.0,<=9.1.1. The version constraint of dependency requests can be changed to >=0.2.1,<=0.2.3. The version constraint of dependency requests can be changed to >=0.7.0,<=2.24.0. The version constraint of dependency requests can be changed to ==2.26.0.
The above modification suggestions can reduce the dependency conflicts as much as possible, and introduce the latest version as much as possible without calling Error in the projects.
The invocation of the current project includes all the following methods.
The calling methods from the numpy
numpy.linalg.norm
The calling methods from the pillow
PIL.Image.open
The calling methods from the requests
requests.get
The calling methods from the all methods
self.infos.setdefault.append calibrator.ImageFolderCalibDataset os.path.basename self._load_pretrained_model mlsd_pytorch.utils.decode.deccode_lines_TP self.load_label mlsd_pytorch.data.utils.cut_line_by_xmin model len_and_angle_loss_func io.BytesIO self.modules segment_list.np.array.reshape numpy.float32.precisions.np.array.mean pred_lines.detach.cpu.numpy.detach yx.detach.cpu.numpy.detach heat.cpu.numpy.reshape self.infos.setdefault self.matching_loss_func self.block21 flask.json.dump msgs.append build_argparser.parse_args build_argparser batch_data.cuda index.self.anns.copy numpy.stack.reshape image.copy.copy weighted_bce_with_logits self.block13 torch.nn.init.zeros_ yacs.config.CfgNode.clone im.transpose time.time torch.utils.model_zoo.load_url self.Line_Dataset.super.__init__ self.line_and_juc_seg_loss max_acc_map.acc_map.float xx.yy.displacement.reshape models.mbv2_mlsd_tiny.MobileV2_MLSD_Tiny.cuda numpy.load xx.yy.displacement.reshape.permute self.block12 torch.floor_divide self._m_match_loss_fn self.model.state_dict logger.info mlsd_pytorch.models.mbv2_mlsd_large.MobileV2_MLSD_Large torch.nn.functional.max_pool2d.numpy numpy.expand_dims self.val self._geo_aug numpy.argmin torch.nn.init.constant gt.lt acc_map_np.torch.from_numpy.unsqueeze.unsqueeze gen_TP_mask2 flask.send_from_directory torch.onnx.export numpy.argmax PIL.Image.open flask.Flask torch.cuda.manual_seed __mapping_dataset.keys torch.nn.functional.binary_cross_entropy_with_logits torch.nn.init.normal_ mlsd_pytorch.data.utils.swap_line_pt_maybe displacement_loss_func mlsd_pytorch.models.mbv2_mlsd.MobileV2_MLSD numpy.fliplr albumentations.OneOf pos_pred.nelement xmax_lines.append mlsd_pytorch.data.utils.TP_map_to_line_numpy numpy.max exit lines_gt.lines_dt.sum near_area_n self.sol_mask_loss square_list.append bisect.bisect_right loss_dict.update numpy.array models.mbv2_mlsd_large.MobileV2_MLSD_Large.cuda self.scheduler.get_lr heat.cpu.numpy.cpu img.torch.from_numpy.unsqueeze.float.cuda self._line_len_fn requests.get numpy.unique thop.profile max_acc_map.acc_map.float.reshape torch.abs torch.randn.float.to self.backbone self.model.train Line_Dataset torch.nn.functional.pairwise_distance torch.optim.Adam torch.nn.init.kaiming_normal_ train self.MobileV2_MLSD_Tiny.super.__init__ torch.load dis_list.transpose.transpose heat.hmax.float anns.append junction_map.min.min mlsd_pytorch.cfg.default.get_cfg_defaults.merge_from_file line_len_and_angle f.close lines_gt.reshape.reshape enumerate torch2trt.torch2trt.load_state_dict gt_dis.pred_dis.F.smooth_l1_loss.sum.min lines_dt.reshape.reshape inter_y.inter_x.np.concatenate.astype self.load norm_lines_512_list.append model_graph.decode_image numpy.min pred.unsqueeze utils.pred_lines args.config.strip random.seed scores.detach.cpu.numpy.detach argparse.ArgumentParser models.mbv2_mlsd_large.MobileV2_MLSD_Large r_lines.append numpy.concatenate.append torch.cat torch.nn.MaxPool2d numpy.arccos numpy.transpose self.block23 tensorflow.lite.Interpreter.allocate_tensors cfg.build_model.cuda.eval numpy.random.seed angle_loss.sum.sum cv2.line img.torch.from_numpy.unsqueeze model_graph.save_output self.MobileV2_MLSD.super.__init__ torch.nn.Sequential numpy.minimum self.infos.iteritems torch.nn.init.ones_ os.path.join infer_one train_loss.item self.bilinear_kernel img_origin_list.append batch_image.torch.from_numpy.float.cuda mlsd_pytorch.data.utils.gen_SOL_map cfg.build_model.cuda.eval.load_state_dict neg_mask.loss.sum gt.eq.float resized_image.transpose.transpose fpn_features.append mlsd_pytorch.learner.Simple_MLSD_Learner torch.zeros_like join self.block16 torch.ones numpy.float mlsd_pytorch.data.utils.cut_line_by_xmax format module self.scheduler.step indices.hough.astype near_area_n.extend cfg.datasets.name.__mapping_dataset build_argparser.parse_args.add_argument deccode_output_score_and_ptss self.LineSegmentLoss.super.__init__ gt_dis.pred_dis.F.smooth_l1_loss.sum self.logger.write numpy.linalg.norm numpy.sort ConvBNReLU BlockTypeA numpy.array.append self.loss_fn.item numpy.ones msTPFP tensorflow.lite.Interpreter.get_output_details img_fns.append ptss.detach.cpu.numpy pred_infos.append numpy.float32.f_scores.np.array.mean torch.argsort numpy.flipud heat.reshape.reshape max numpy.asarray tensorflow.lite.Interpreter.set_tensor yx.detach.cpu line_pred.reshape.reshape get_collate_fn torch.log torch2trt.torch2trt.state_dict norm_lines_512_all_tensor_list.append displacement.detach.cpu.numpy segment_list.append random.random torch.nn.BatchNorm2d numpy.array.detach yacs.config.CfgNode self.block14 numpy.reshape self.WarmupMultiStepLR.super.__init__ MobileV2_MLSD torch.arange cfg.build_model.cuda.load_state_dict self.BlockTypeC.super.__init__ NotImplementedError f super.__init__ tensorflow.lite.Interpreter self.model.parameters str pred_lines.detach.cpu.numpy numpy.sqrt pos_mask.unsqueeze.sum self.ConvBNReLU.super.__init__ time.monotonic mlsd_pytorch.data.utils.gen_TP_mask2 torch.randn models.mbv2_mlsd_tiny.MobileV2_MLSD_Tiny torch.device norm_lines.append line_gt.reshape.reshape float mlsd_pytorch.data.utils.get_ext_lines self.BlockTypeB.super.__init__ mlsd_pytorch.cfg.default.get_cfg_defaults.dump cv2.resize main parse_label_file_info.append albumentations.Normalize loss_dict.items gt_dis.pred_dis2.F.smooth_l1_loss.sum get_ext_lines layers.append mlsd_pytorch.metric.F1_score_128 pos_inds.float.sum MobileNetV2 yx.detach.cpu.numpy ann_origin.copy.append numpy.roll torch.optim.lr_scheduler.LambdaLR mlsd_pytorch.learner.Simple_MLSD_Learner.train square.reshape cfg.build_model.cuda self.model.zero_grad self.MobileV2_MLSD_Large.super.__init__ self.cache_dict.keys isinstance norm_lines_512_all.append line_gt.line_pred.sum torch.nn.ReLU6 self.BlockTypeA.super.__init__ x0.abs self.InvertedResidual.super.__init__ self.state_dict mlsd_pytorch.data.utils.deccode_lines albumentations.RandomBrightnessContrast connect_list.append cv2.imdecode cv2.imwrite numpy.maximum torch.utils.model_zoo.load_url.items self.log_file.close numpy.where recalls.append block pred_lines_fn cv2.GaussianBlur sorted abs self.conv3 pos_mask.loss.sum torch.div torch.fmod mlsd_pytorch.data.get_train_dataloader self.tp_mask_loss self.loss_w_dict.keys displacement.detach.cpu.numpy.detach torch.nn.functional.interpolate mlsd_pytorch.data.utils.gen_junction_and_line_mask self.model mlsd_pytorch.utils.comm.setup_seed torch.sigmoid torch.topk tensorflow.lite.Interpreter.get_input_details numpy.float32.recalls.np.array.mean layers.extend BlockTypeC numpy.abs displacement.transpose.detach y0.abs parse_label_file_info tensorflow.lite.Interpreter.invoke self.block18 acc_map_np.torch.from_numpy.unsqueeze torch.sqrt.sum torch.sqrt list numpy.arctan self._m_gt_matched_n tqdm.tqdm torchvision.datasets.ImageFolder pos_loss.sum.sum x.torch.from_numpy.unsqueeze _C.clone.merge_from_other_cfg numpy.frombuffer near_area_n.detach torch.cuda.current_stream.synchronize flask.request.files.save _nms self.draw_output models.mbv2_mlsd_large.MobileV2_MLSD_Large.cuda.eval.load_state_dict __mapping_dataset_collate_fn.keys w.indices.torch.fmod.unsqueeze pos_mask.unsqueeze.unsqueeze milestones.append albumentations.HueSaturationValue self._load_anns torch.sum MobileV2_MLSD_Large torch.nn.ReLU torch.cuda.manual_seed_all torch.abs.view torch.cuda.is_available self.test_aug tqdm.tqdm.set_description mlsd_pytorch.utils.comm.create_dir gt_lines.cuda.cuda img.torch.from_numpy.unsqueeze.float cv2.circle len self.loss_w_dict.update os.mkdir segments_list.append corner_info.corner_dict.append ConvBNReLU.append self.step mlsd_pytorch.cfg.default.get_cfg_defaults torch2trt.torch2trt self.block22 mlsd_pytorch.data.get_val_dataloader albumentations.Compose open mlsd_pytorch.metric.msTPFP os.makedirs heat.cpu.numpy self.block15 self._crop_aug check_outside_inside cv2.cvtColor os.path.splitext BilinearConvTranspose2d self.log_file.write models.mbv2_mlsd_tiny.MobileV2_MLSD_Tiny.to torch.nn.functional.pad random.randint x.torch.from_numpy.unsqueeze.unsqueeze gt.eq self.loss_fn device.MobileV2_MLSD_Tiny.to.eval loss.backward square_list.np.array.reshape mlsd_pytorch.loss.LineSegmentLoss torch.cdist pred_lines_list.append near_area_n.append batch_image.torch.from_numpy.float outputs.unsqueeze.unsqueeze torch.nn.Conv2d mlsd_pytorch.optim.lr_scheduler.WarmupMultiStepLR torch.nn.utils.clip_grad_norm_ model.engine.serialize mlsd_pytorch.metric.AP model_graph.read_image ptss.detach.cpu get_args torch.randn.float heat.torch.from_numpy.unsqueeze y1.abs onnx_convert xmax.img.copy AP args.config.endswith center_pos.transpose.transpose model.eval.eval segments_list.np.array.reshape resized_image.np.expand_dims.astype img.torch.from_numpy.unsqueeze.float.cuda.transpose square_length.append torch.pow gt_infos.append self.block20 f.write flask.Flask.run cv2.polylines torch.utils.data.DataLoader w.indices.torch.floor_divide.unsqueeze self._forward_impl math.cos flask.render_template self._aug_train super len_loss.sum.sum w.indices.torch.div.unsqueeze json.load displacement_loss_func.sum mlsd_pytorch.utils.logger.TxtLogger response.content.BytesIO.Image.open.convert numpy.clip pred_lines.detach.cpu cfg.build_model.cuda.parameters argparse.ArgumentParser.add_argument_group gt_lines_128.tolist torch.manual_seed print self.load_state_dict junction_map.min.max models.mbv2_mlsd_tiny.MobileV2_MLSD_Tiny.cuda.eval.load_state_dict calculate_sAP self.conv torch.save pred_lines_128.tolist x1.abs self.train_aug f_scores.append pickle.dump numpy.arctan2 pickle.load ann_origin.copy torch.nn.functional.l1_loss os.path.exists self.block17.reset_parameters xmin_lines.append range torch.no_grad io.BytesIO.getvalue test_aug numpy.argsort numpy.mean argparse.ArgumentParser.add_argument self.log_file.flush argparse.ArgumentParser.parse_args cv2.imread mlsd_pytorch.models.build_model.build_model ImportError model.read_image.copy neg_loss.sum.sum round numpy.concatenate models.mbv2_mlsd_tiny.MobileV2_MLSD_Tiny.cuda.eval displacement.transpose.transpose self.optimizer.step mlsd_pytorch.utils.meter.AverageMeter torch.ones_like uuid.uuid1 centermap.min.min models.mbv2_mlsd_large.MobileV2_MLSD_Large.cuda.eval torch.cuda.current_stream torch.nn.functional.smooth_l1_loss model_graph.pred torch.nn.functional.max_pool2d junc_list.append utils.pred_squares self._aug_test numpy.stack scores.detach.cpu.numpy self.block17 scores.detach.cpu os.path.dirname self.conv2 displacement.detach.cpu centermap.min.max int numpy.save model_graph self.state_dict.update zip json_content.append _func.focal_neg_loss_with_logits flask.Flask.route tensorflow.lite.Interpreter.get_tensor F.interpolate sys.path.append torch.where torch.from_numpy cv2.rotate merged_segments.append numpy.sum precisions.append ValueError numpy.zeros _make_divisible get_dataset init_worker ptss.detach.cpu.numpy.detach flipped_lines.append self.init_resize_image BlockTypeB new_hough.current_hough.all self.MobileNetV2.super.__init__ self.block19 sol_lines_512_all_tensor_list.append numpy.cumsum mlsd_pytorch.utils.meter.AverageMeter.update self.conv1 get_ext_lines.append
@developer Could please help me check this issue? May I pull a request to fix it? Thank you very much.
pull a request is pretty welcome