{"id":24475,"library":"pytorchcv","title":"PyTorchCV","description":"PyTorchCV provides a collection of computer vision models (classification, segmentation, detection, etc.) for PyTorch, with pretrained weights. Current version 0.0.74, release cadence is irregular. Requires Python >=3.10.","status":"active","version":"0.0.74","language":"python","source_language":"en","source_url":"https://github.com/osmr/pytorchcv","tags":["computer-vision","models","pretrained","classification"],"install":[{"cmd":"pip install pytorchcv","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"get_model is the primary function to load any model by name.","symbol":"get_model","correct":"from pytorchcv.model_provider import get_model"}],"quickstart":{"code":"import torch\nfrom pytorchcv.model_provider import get_model\n\nmodel = get_model('resnet18', pretrained=True)\nmodel.eval()\nx = torch.randn(1, 3, 224, 224)\nwith torch.no_grad():\n    out = model(x)\nprint(out.shape)","lang":"python","description":"Quickstart: load a pretrained ResNet-18 model and run inference on a random tensor."},"warnings":[{"fix":"Use lowercase names; check available models via pytorchcv.model_provider.get_model_list().","message":"Model names are case-sensitive and must match exactly the keys in model_provider (e.g., 'resnet18' works, 'ResNet18' does not).","severity":"gotcha","affected_versions":"all"},{"fix":"Replace direct class imports with get_model('model_name').","message":"Some older model APIs (e.g., direct import of model classes from pytorchcv.models) may be deprecated in future releases. Use get_model() for future compatibility.","severity":"deprecated","affected_versions":">=0.0.50"},{"fix":"Set environment variable PYTORCHCV_CACHE_DIR to customize cache location; consider pre-downloading weights.","message":"Pretrained weights download from a remote server; if the server is down or slow, model loading may fail or hang. There is no fallback or mirror.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run: pip install pytorchcv","cause":"Package not installed or installed in wrong environment.","error":"ModuleNotFoundError: No module named 'pytorchcv'"},{"fix":"Check list of models: from pytorchcv.model_provider import get_model_list; print(get_model_list())","cause":"Using incorrect model name (case or spelling).","error":"KeyError: 'resnet18'"},{"fix":"Ensure internet connection or set pretrained=False to load architecture without weights.","cause":"Model returned None because pretrained weights failed to load (network issue).","error":"AttributeError: 'NoneType' object has no attribute 'shape'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}