hadilq
/
hair-segment
This is an ML model to segment hairs in pictures.
- Public
- 153 runs
-
CPU
- GitHub
Prediction
hadilq/hair-segment:b335dc1b693b2de88040736eb426702adfc2f0c869ae9dba3569bac1beb9c0f6IDa2s2khdg6drg80cfjvktcp8x24StatusSucceededSourceWebHardwareCPUTotal durationCreatedInput
{ "image": "https://replicate.delivery/pbxt/Kx8cDMB9AF9D2Xs7wQVTCOjmnYLtmpPoHIhAIwry4146XEKX/pexels-luis-fernando-7211043_jpg.rf.34504c5f2de20e18c2c92e418764832b.jpg" }
Install Replicate’s Node.js client library:npm install replicate
Import and set up the client:import Replicate from "replicate"; const replicate = new Replicate({ auth: process.env.REPLICATE_API_TOKEN, });
Run hadilq/hair-segment using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run( "hadilq/hair-segment:b335dc1b693b2de88040736eb426702adfc2f0c869ae9dba3569bac1beb9c0f6", { input: { image: "https://replicate.delivery/pbxt/Kx8cDMB9AF9D2Xs7wQVTCOjmnYLtmpPoHIhAIwry4146XEKX/pexels-luis-fernando-7211043_jpg.rf.34504c5f2de20e18c2c92e418764832b.jpg" } } ); // To access the file URL: console.log(output.url()); //=> "http://example.com" // To write the file to disk: fs.writeFile("my-image.png", output);
To learn more, take a look at the guide on getting started with Node.js.
Install Replicate’s Python client library:pip install replicate
Import the client:import replicate
Run hadilq/hair-segment using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run( "hadilq/hair-segment:b335dc1b693b2de88040736eb426702adfc2f0c869ae9dba3569bac1beb9c0f6", input={ "image": "https://replicate.delivery/pbxt/Kx8cDMB9AF9D2Xs7wQVTCOjmnYLtmpPoHIhAIwry4146XEKX/pexels-luis-fernando-7211043_jpg.rf.34504c5f2de20e18c2c92e418764832b.jpg" } ) print(output)
To learn more, take a look at the guide on getting started with Python.
Run hadilq/hair-segment using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
curl -s -X POST \ -H "Authorization: Bearer $REPLICATE_API_TOKEN" \ -H "Content-Type: application/json" \ -H "Prefer: wait" \ -d $'{ "version": "b335dc1b693b2de88040736eb426702adfc2f0c869ae9dba3569bac1beb9c0f6", "input": { "image": "https://replicate.delivery/pbxt/Kx8cDMB9AF9D2Xs7wQVTCOjmnYLtmpPoHIhAIwry4146XEKX/pexels-luis-fernando-7211043_jpg.rf.34504c5f2de20e18c2c92e418764832b.jpg" } }' \ https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
Output
{ "completed_at": "2024-05-20T16:50:55.265953Z", "created_at": "2024-05-20T16:48:37.427000Z", "data_removed": false, "error": null, "id": "a2s2khdg6drg80cfjvktcp8x24", "input": { "image": "https://replicate.delivery/pbxt/Kx8cDMB9AF9D2Xs7wQVTCOjmnYLtmpPoHIhAIwry4146XEKX/pexels-luis-fernando-7211043_jpg.rf.34504c5f2de20e18c2c92e418764832b.jpg" }, "logs": "image 1/1 /tmp/tmpka4bko2npexels-luis-fernando-7211043_jpg.rf.34504c5f2de20e18c2c92e418764832b.jpg: 640x640 1 hair, 3677.9ms\nSpeed: 1.8ms preprocess, 3677.9ms inference, 596.5ms postprocess per image at shape (1, 3, 640, 640)\narea: 29065\nexpand_factor: 71\nvectorized_pixels len: 58091\nK: 3\nK: 4\nK: 5\nK: 6\nK: 7\nK: 8\nK: 9\nK: 10\nlabel_img shape: (640, 640)\ncount_hair_label: [345, 12574, 813, 1936, 1300, 3097, 6090, 1818, 1036, 56]\ncount_not_hair_label: [3861, 56, 7406, 998, 3503, 925, 249, 2918, 1385, 7725]\nhairy_label: {1, 3, 5, 6}", "metrics": { "predict_time": 26.961457, "total_time": 137.838953 }, "output": "https://replicate.delivery/pbxt/8ZU45wQPEqIJBdEb4GHuZyMrYAHZN27l9SlriXHVBw9bxktE/output.jpg", "started_at": "2024-05-20T16:50:28.304496Z", "status": "succeeded", "urls": { "get": "https://api.replicate.com/v1/predictions/a2s2khdg6drg80cfjvktcp8x24", "cancel": "https://api.replicate.com/v1/predictions/a2s2khdg6drg80cfjvktcp8x24/cancel" }, "version": "b335dc1b693b2de88040736eb426702adfc2f0c869ae9dba3569bac1beb9c0f6" }
Generated inimage 1/1 /tmp/tmpka4bko2npexels-luis-fernando-7211043_jpg.rf.34504c5f2de20e18c2c92e418764832b.jpg: 640x640 1 hair, 3677.9ms Speed: 1.8ms preprocess, 3677.9ms inference, 596.5ms postprocess per image at shape (1, 3, 640, 640) area: 29065 expand_factor: 71 vectorized_pixels len: 58091 K: 3 K: 4 K: 5 K: 6 K: 7 K: 8 K: 9 K: 10 label_img shape: (640, 640) count_hair_label: [345, 12574, 813, 1936, 1300, 3097, 6090, 1818, 1036, 56] count_not_hair_label: [3861, 56, 7406, 998, 3503, 925, 249, 2918, 1385, 7725] hairy_label: {1, 3, 5, 6}
Prediction
hadilq/hair-segment:b335dc1b693b2de88040736eb426702adfc2f0c869ae9dba3569bac1beb9c0f6IDpmrqqpbxx5rgc0cfjve9ds0240StatusSucceededSourceWebHardwareCPUTotal durationCreatedInput
{ "image": "https://replicate.delivery/pbxt/Kx8QdlrmR21GB2oBIkHRmbPOoMJsL3PN081IVQ54WnnXan7N/00322-3887184730_png.rf.9e8de7a3d900dbbdc8a757d37986ab90.jpg" }
Install Replicate’s Node.js client library:npm install replicate
Import and set up the client:import Replicate from "replicate"; const replicate = new Replicate({ auth: process.env.REPLICATE_API_TOKEN, });
Run hadilq/hair-segment using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run( "hadilq/hair-segment:b335dc1b693b2de88040736eb426702adfc2f0c869ae9dba3569bac1beb9c0f6", { input: { image: "https://replicate.delivery/pbxt/Kx8QdlrmR21GB2oBIkHRmbPOoMJsL3PN081IVQ54WnnXan7N/00322-3887184730_png.rf.9e8de7a3d900dbbdc8a757d37986ab90.jpg" } } ); // To access the file URL: console.log(output.url()); //=> "http://example.com" // To write the file to disk: fs.writeFile("my-image.png", output);
To learn more, take a look at the guide on getting started with Node.js.
Install Replicate’s Python client library:pip install replicate
Import the client:import replicate
Run hadilq/hair-segment using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run( "hadilq/hair-segment:b335dc1b693b2de88040736eb426702adfc2f0c869ae9dba3569bac1beb9c0f6", input={ "image": "https://replicate.delivery/pbxt/Kx8QdlrmR21GB2oBIkHRmbPOoMJsL3PN081IVQ54WnnXan7N/00322-3887184730_png.rf.9e8de7a3d900dbbdc8a757d37986ab90.jpg" } ) print(output)
To learn more, take a look at the guide on getting started with Python.
Run hadilq/hair-segment using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
curl -s -X POST \ -H "Authorization: Bearer $REPLICATE_API_TOKEN" \ -H "Content-Type: application/json" \ -H "Prefer: wait" \ -d $'{ "version": "b335dc1b693b2de88040736eb426702adfc2f0c869ae9dba3569bac1beb9c0f6", "input": { "image": "https://replicate.delivery/pbxt/Kx8QdlrmR21GB2oBIkHRmbPOoMJsL3PN081IVQ54WnnXan7N/00322-3887184730_png.rf.9e8de7a3d900dbbdc8a757d37986ab90.jpg" } }' \ https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
Output
{ "completed_at": "2024-05-20T16:38:35.315865Z", "created_at": "2024-05-20T16:36:23.657000Z", "data_removed": false, "error": null, "id": "pmrqqpbxx5rgc0cfjve9ds0240", "input": { "image": "https://replicate.delivery/pbxt/Kx8QdlrmR21GB2oBIkHRmbPOoMJsL3PN081IVQ54WnnXan7N/00322-3887184730_png.rf.9e8de7a3d900dbbdc8a757d37986ab90.jpg" }, "logs": "image 1/1 /tmp/tmpdegcdbop00322-3887184730_png.rf.9e8de7a3d900dbbdc8a757d37986ab90.jpg: 640x640 1 hair, 3105.2ms\nSpeed: 2.1ms preprocess, 3105.2ms inference, 653.0ms postprocess per image at shape (1, 3, 640, 640)\narea: 11023\nexpand_factor: 44\nvectorized_pixels len: 27656\nK: 3\nK: 4\nK: 5\nK: 6\nlabel_img shape: (640, 640)\ncount_hair_label: [1487, 2451, 3081, 1789, 0, 2215]\ncount_not_hair_label: [3479, 1542, 1530, 3265, 2909, 3908]\nhairy_label: {1, 2}", "metrics": { "predict_time": 13.580857, "total_time": 131.658865 }, "output": "https://replicate.delivery/pbxt/WfdCGWTWhZQRAiOcdRYUliRGNX8SRao9SP12N7kDrLeL6S2SA/output.jpg", "started_at": "2024-05-20T16:38:21.735008Z", "status": "succeeded", "urls": { "get": "https://api.replicate.com/v1/predictions/pmrqqpbxx5rgc0cfjve9ds0240", "cancel": "https://api.replicate.com/v1/predictions/pmrqqpbxx5rgc0cfjve9ds0240/cancel" }, "version": "b335dc1b693b2de88040736eb426702adfc2f0c869ae9dba3569bac1beb9c0f6" }
Generated inimage 1/1 /tmp/tmpdegcdbop00322-3887184730_png.rf.9e8de7a3d900dbbdc8a757d37986ab90.jpg: 640x640 1 hair, 3105.2ms Speed: 2.1ms preprocess, 3105.2ms inference, 653.0ms postprocess per image at shape (1, 3, 640, 640) area: 11023 expand_factor: 44 vectorized_pixels len: 27656 K: 3 K: 4 K: 5 K: 6 label_img shape: (640, 640) count_hair_label: [1487, 2451, 3081, 1789, 0, 2215] count_not_hair_label: [3479, 1542, 1530, 3265, 2909, 3908] hairy_label: {1, 2}
Prediction
hadilq/hair-segment:b335dc1b693b2de88040736eb426702adfc2f0c869ae9dba3569bac1beb9c0f6ID8jd0byn1jdrg80cfjvgvd857cmStatusSucceededSourceWebHardwareCPUTotal durationCreatedInput
{ "image": "https://replicate.delivery/pbxt/Kx8VwrHsdOhWnha6IU3q9Q5dPNY9oOC7bufReRUbAD8mZ5Bb/kids-4305233_jpg.rf.3414689ebc4628441fb7c0db5a9bc6f4.jpg" }
Install Replicate’s Node.js client library:npm install replicate
Import and set up the client:import Replicate from "replicate"; const replicate = new Replicate({ auth: process.env.REPLICATE_API_TOKEN, });
Run hadilq/hair-segment using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run( "hadilq/hair-segment:b335dc1b693b2de88040736eb426702adfc2f0c869ae9dba3569bac1beb9c0f6", { input: { image: "https://replicate.delivery/pbxt/Kx8VwrHsdOhWnha6IU3q9Q5dPNY9oOC7bufReRUbAD8mZ5Bb/kids-4305233_jpg.rf.3414689ebc4628441fb7c0db5a9bc6f4.jpg" } } ); // To access the file URL: console.log(output.url()); //=> "http://example.com" // To write the file to disk: fs.writeFile("my-image.png", output);
To learn more, take a look at the guide on getting started with Node.js.
Install Replicate’s Python client library:pip install replicate
Import the client:import replicate
Run hadilq/hair-segment using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run( "hadilq/hair-segment:b335dc1b693b2de88040736eb426702adfc2f0c869ae9dba3569bac1beb9c0f6", input={ "image": "https://replicate.delivery/pbxt/Kx8VwrHsdOhWnha6IU3q9Q5dPNY9oOC7bufReRUbAD8mZ5Bb/kids-4305233_jpg.rf.3414689ebc4628441fb7c0db5a9bc6f4.jpg" } ) print(output)
To learn more, take a look at the guide on getting started with Python.
Run hadilq/hair-segment using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
curl -s -X POST \ -H "Authorization: Bearer $REPLICATE_API_TOKEN" \ -H "Content-Type: application/json" \ -H "Prefer: wait" \ -d $'{ "version": "b335dc1b693b2de88040736eb426702adfc2f0c869ae9dba3569bac1beb9c0f6", "input": { "image": "https://replicate.delivery/pbxt/Kx8VwrHsdOhWnha6IU3q9Q5dPNY9oOC7bufReRUbAD8mZ5Bb/kids-4305233_jpg.rf.3414689ebc4628441fb7c0db5a9bc6f4.jpg" } }' \ https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
Output
{ "completed_at": "2024-05-20T16:44:29.961652Z", "created_at": "2024-05-20T16:42:00.467000Z", "data_removed": false, "error": null, "id": "8jd0byn1jdrg80cfjvgvd857cm", "input": { "image": "https://replicate.delivery/pbxt/Kx8VwrHsdOhWnha6IU3q9Q5dPNY9oOC7bufReRUbAD8mZ5Bb/kids-4305233_jpg.rf.3414689ebc4628441fb7c0db5a9bc6f4.jpg" }, "logs": "image 1/1 /tmp/tmpns8t_q85kids-4305233_jpg.rf.3414689ebc4628441fb7c0db5a9bc6f4.jpg: 640x640 2 hairs, 6672.2ms\nSpeed: 15.4ms preprocess, 6672.2ms inference, 1260.6ms postprocess per image at shape (1, 3, 640, 640)\narea: 8388\nexpand_factor: 38\nvectorized_pixels len: 20712\nK: 3\nK: 4\nK: 5\nK: 6\nlabel_img shape: (640, 640)\ncount_hair_label: [90, 3066, 1678, 650, 2662, 242]\ncount_not_hair_label: [1982, 12, 849, 8281, 145, 1055]\nhairy_label: {1, 2, 4}", "metrics": { "predict_time": 19.785534, "total_time": 149.494652 }, "output": "https://replicate.delivery/pbxt/oXi571fIH8WtL6YT7E5SdaKgofdAulxJILLrRpjw9gLtflslA/output.jpg", "started_at": "2024-05-20T16:44:10.176118Z", "status": "succeeded", "urls": { "get": "https://api.replicate.com/v1/predictions/8jd0byn1jdrg80cfjvgvd857cm", "cancel": "https://api.replicate.com/v1/predictions/8jd0byn1jdrg80cfjvgvd857cm/cancel" }, "version": "b335dc1b693b2de88040736eb426702adfc2f0c869ae9dba3569bac1beb9c0f6" }
Generated inimage 1/1 /tmp/tmpns8t_q85kids-4305233_jpg.rf.3414689ebc4628441fb7c0db5a9bc6f4.jpg: 640x640 2 hairs, 6672.2ms Speed: 15.4ms preprocess, 6672.2ms inference, 1260.6ms postprocess per image at shape (1, 3, 640, 640) area: 8388 expand_factor: 38 vectorized_pixels len: 20712 K: 3 K: 4 K: 5 K: 6 label_img shape: (640, 640) count_hair_label: [90, 3066, 1678, 650, 2662, 242] count_not_hair_label: [1982, 12, 849, 8281, 145, 1055] hairy_label: {1, 2, 4}
Want to make some of these yourself?
Run this model